tencent cloud

Feedback

CreateInstances

Last updated: 2024-12-04 11:19:29

    1. API Description

    Domain name for API request: redis.intl.tencentcloudapi.com.

    This API is used to create an TencentDB or Redis instance.

    A maximum of 20 requests can be initiated per second for this API.

    We recommend you to use API Explorer
    Try it
    API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

    2. Input Parameters

    The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

    Parameter Name Required Type Description
    Action Yes String Common Params. The value used for this API: CreateInstances.
    Version Yes String Common Params. The value used for this API: 2018-04-12.
    Region Yes String Common Params. For more information, please see the list of regions supported by the product.
    TypeId Yes Integer Instance type.
    • 2: Redis 2.8 Memory Edition (standard architecture);
    • 3: CKV 3.2 Memory Edition (standard architecture);
    • 4: CKV 3.2 Memory Edition (cluster architecture);
    • 6: Redis 4.0 Memory Edition (standard architecture);
    • 7: Redis 4.0 Memory Edition (cluster architecture);
    • 8: Redis 5.0 Memory Edition (standard architecture);
    • 9: Redis 5.0 Memory Edition (cluster architecture);
    • 15: Redis 6.2 Memory Edition (standard architecture);
    • 16: Redis 6.2 Memory Edition (cluster architecture);
    • 17: Redis 7.0 Memory Edition (standard architecture);
    • 18: Redis 7.0 Memory Edition (cluster architecture).
    • Note: The CKV version is currently used by existing users and is temporarily retained.
    MemSize Yes Integer Memory capacity in MB, which must be an integer multiple of 1024. For specific specifications, query the sales specifications in all regions through the DescribeProductInfo API.
    - When TypeId is a standard architecture, MemSize is the total memory capacity of the instance;
    - When TypeId is a cluster architecture, MemSize is the single-shard memory capacity.
    GoodsNum Yes Integer The number of instances for each purchase. For details, query the sales specifications in all regions through the DescribeProductInfo API.
    Period Yes Integer The purchase duration of an instance
    - If BillingMode is 1, that is, when the billing mode is monthly subscription, you need to set this parameter to specify the duration of the purchased instance. Unit: month. Value range: [1,2,3,4,5,6,7,8,9,10,11,12,24,36].
    - If BillingMode is 0, that is, when the billing mode is pay-as-you-go, you need to set this parameter to 1.
    BillingMode Yes Integer Billing mode. 0: pay-as-you-go
    ZoneId No Integer ID of the AZ where the instance resides. For more information, see Regions and AZs.
    Password No String Password for accessing instances.
    - When the input parameter NoAuth is set to true, password-free access is set for instances and Password does not need to be configured. Otherwise, Password is required.
    - When the instance type parameter TypeId is set to Redis 2.8 Memory Edition (standard architecture) or Redis 4.0, 5.0, or 6.0 Memory Edition (standard architecture or cluster architecture), the password cannot start with a forward slash (/) and should contain 8 to 64 characters, including at least two of the following types: lowercase letters, uppercase letters, digits, and special characters (such as ()`~!@#$%^&*-+=_|{}[]:;<>,.?/).
    - When the instance type parameter TypeId is set to CKV 3.2 Memory Edition (standard architecture or cluster architecture), the password should contain 8 to 30 characters, including only letters and digits.
    VpcId No String VPC ID. If this parameter is not passed in, the classic network will be selected by default. You can query the specific VPC ID in the VPC console.
    SubnetId No String VPC subnet ID. This parameter is not required for the classic network. You can get the specific subnet ID by querying the subnet list in the VPC console.
    ProjectId No Integer Project ID. Log in to the Redis console, go to the account information menu in the top-right corner, and select Project Management to query the project ID.
    AutoRenew No Integer Auto-renewal flag
    - 0: Manual renewal (default).
    - 1: Auto-renewal.
    - 2: Not auto-renewal (set by user).
    SecurityGroupIdList.N No Array of String Array of security group IDs.
    - A security group is a virtual firewall that controls network access to cloud database instances. It is recommended to bind the corresponding security group when you create an instance.
    - Obtain the security group ID of the instance through the API DescribeInstanceSecurityGroup.
    VPort No Integer User-defined network port. Default value: 6379. Range: [1024,65535].
    RedisShardNum No Integer Quantity of instance shards
    - This parameter is not required for instances of Standard Edition.
    - For instances of Cluster Edition, the range of shard quantity is [1, 3, 5, 8, 12, 16, 24, 32, 40, 48, 64, 80, 96, 128].
    RedisReplicasNum No Integer Quantity of instance replicas
    - For Redis Memory Edition 4.0, 5.0, 6.2 (regardless of architecture), the range of replica quantity is [1,5].
    - For Redis 2.8 Standard Edition and CKV Standard Edition, the replica quantity is 1.
    ReplicasReadonly No Boolean Whether to support read-only replicas.
    - Redis 2.8 Standard Edition and CKV Standard Edition don’t support read-only replicas.
    - If read-only replicas are enabled, read/write separation will be automatically enabled for an instance, with write requests routed to the master node and read requests to the replica node.
    - To enable read-only replicas, we recommend that you create two or more replicas.
    InstanceName No String Instance name, which can contain up to 60 letters, digits, hyphens, and underscores.
    NoAuth No Boolean Whether to support password-free access for an instance
    - true: The instance access is password-free.
    - false: The instance access is password-enabled. Default value: false. Only instances in a VPC support the password-free access.
    NodeSet.N No Array of RedisNodeInfo The node information of the instance, including node ID, type, and AZ. For more information, see RedisNodeInfo.
    Node information of an instance. Currently, information about the node type (master or replica) and node AZ can be passed in. This parameter is not required for instances deployed in a single AZ.
    ResourceTags.N No Array of ResourceTag The tag for an instance
    ZoneName No String Name of the AZ where the instance resides. For more information, see Regions and AZs.
    TemplateId No String The parameter template ID associated with the instance
    - If this parameter is not configured, the system will automatically adapt the corresponding default template based on the selected compatible version and architecture.
    - Query the list of parameter templates of an instance to get the template ID through the DescribeParamTemplates API.
    DryRun No Boolean An internal parameter used to indicate whether to check when creating an instance.
    - false: Default value. Send a normal request and create an instance if all the requirements are met.
    - true: Send a check request and create no instance.
    ProductVersion No String The product edition of the instance
    - local: Local Disk Edition.
    - cloud: Cloud Disk Edition.
    - cdc: Dedicated Cluster Edition. Default value: local.
    RedisClusterId No String Exclusive cluster ID. When ProductVersion is set to cdc, this parameter is required.
    AlarmPolicyList.N No Array of String Alarm policy ID array.- Please log in to Tencent Cloud Observability Platform - Alarm Management - Policy Management to access the alarm policy ID.- If this parameter is not configured, the default alarm policy will be bound. For the specific information about the default alarm policy, please log in to Tencent Cloud Observability Platform - Alarm Management - Policy Management to view.

    3. Output Parameters

    Parameter Name Type Description
    DealId String Transaction ID
    InstanceIds Array of String Instance ID
    RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

    4. Example

    Example1 Request Example 1

    This example shows you how to purchase a monthly subscribed Redis 5.0 Memory Edition (cluster architecture) instance.

    Input Example

    POST / HTTP/1.1
    Host: redis.intl.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: CreateInstances
    <Common request parameters>
    
    {
        "TypeId": 9,
        "VpcId": "vpc-fmh*****",
        "GoodsNum": 1,
        "RedisShardNum": 3,
        "Period": 3,
        "BillingMode": 1,
        "NoAuth": "true",
        "MemSize": 2048,
        "SubnetId": "subnet-680c****",
        "RedisReplicasNum": 1,
        "ZoneId": 200002
    }
    

    Output Example

    {
        "Response": {
            "DealId": "crs-7xij3fjf",
            "InstanceIds": [
                "crs-7xij3fjf"
            ],
            "RequestId": "a974649c-6776-45aa-ab24-7e450cccd275"
        }
    }
    

    Example2 Request Example 2

    This example shows you how to purchase a pay-as-you-go Redis 4.0 Memory Edition (standard architecture) instance.

    Input Example

    POST / HTTP/1.1
    Host: redis.intl.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: CreateInstances
    <Common request parameters>
    
    {
        "TypeId": 6,
        "Password": "**********",
        "GoodsNum": 1,
        "Period": 1,
        "BillingMode": 0,
        "MemSize": 1024,
        "ZoneId": 100002
    }
    

    Output Example

    {
        "Response": {
            "RequestId": "2a836c00-175f-11eb-aeb3-db134c8d8fec",
            "InstanceIds": [
                "crs-kic39axx"
            ],
            "DealId": "crs-kic39axx"
        }
    }
    

    5. Developer Resources

    SDK

    TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

    Command Line Interface

    6. Error Code

    The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

    Error Code Description
    FailedOperation.PayFailed Payment failed.
    FailedOperation.SystemError Internal system error, which is irrelevant to the business.
    FailedOperation.Unknown Invalid data is entered for weekday.
    InternalError.InternalError Internal error.
    InvalidParameter.EmptyParam The parameter is empty.
    InvalidParameter.OnlyVPCOnSpecZoneId Only VPCs are provided in the Shanghai Finance AZ.
    InvalidParameter.PermissionDenied The API has no CAM permissions.
    InvalidParameterValue.BaseNetWorkAccessDeny The instance is not in a VPC.
    InvalidParameterValue.InvalidInstanceTypeId The type of instances requested for purchase is incorrect (TypeId - 1: Cluster Edition; 2: Master-Replica Edition, i.e., the legacy Master-Replica Edition).
    InvalidParameterValue.InvalidSubnetId The vpcid or subnet ID in the VPC is invalid.
    InvalidParameterValue.PasswordEmpty The password is empty.
    InvalidParameterValue.PasswordFreeDenied Tencent internal accounts are not allowed to use password-free instances.
    InvalidParameterValue.PasswordRuleError When the password is set, the old password passed in by MC does not match the previously set password.
    InvalidParameterValue.SecurityGroupIdsNotExists The request parameter or security group ID is incorrect.
    InvalidParameterValue.UnVpcIdNotExists The uniqVpcId or subnet ID in the VPC is invalid.
    LimitExceeded The quota limit has been reached.
    LimitExceeded.InvalidMemSize The requested capacity is out of the purchasable specification range (memSize should be an integer multiple of 1,024 in MB).
    LimitExceeded.InvalidParameterGoodsNumNotInRange The number of instances requested for purchase at a time is out of the purchasable quantity range.
    LimitExceeded.PeriodExceedMaxLimit The requested length of purchase is more than three years and exceeds the maximum value.
    LimitExceeded.PeriodLessThanMinLimit The length of purchase is invalid. It must be at least one month.
    ResourceInsufficient The resource is insufficient.
    ResourceNotFound.AccountDoesNotExists The UIN value is empty.
    ResourceNotFound.InstanceNotExists No Redis instance is found by the serialId.
    ResourceUnavailable.InstanceDeleted The instance has already been repossessed.
    ResourceUnavailable.NoEnoughVipInVPC The IP resources in the VPC are insufficient.
    ResourceUnavailable.NoRedisService The requested region currently does not provide the Redis service.
    ResourceUnavailable.NoTypeIdRedisService The requested region currently does not provide the requested type of Redis service.
    ResourceUnavailable.SaleOut Resources of the specified type in the region are sold out.
    UnauthorizedOperation.NoCAMAuthed No CAM permissions.
    UnauthorizedOperation.UserNotInWhiteList The user is not in the allowlist.
    UnsupportedOperation The operation is not supported.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support