tencent cloud

文档反馈

CreateInstances

最后更新时间:2024-04-22 11:08:48

    1. API Description

    Domain name for API request: redis.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 No String Common Params. This parameter is not required for this API.
    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).
    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 Instance access password
    - When the input parameter NoAuth is true, it means that the instance access is set to be password-free, and the Password field does not need to be configured; otherwise, Password is a required parameter.
    - When the instance type TypeId is Redis 2.8 Memory Edition (Standard Architecture), Redis 4.0, 5.0, 6.0 (regardless of architecture), the password must contains 8-30 characters in at least two of the following types: lowercase letters, uppercase letters, digits, and symbols (()`~!@#$%^&*-+=_|{}[]:;<>,.?/), and it cannot start with a slash (/).
    - When the instance type TypeId is CKV 3.2 Memory Edition (regardless of architecture), the password contains 8-30 letters and digits and excludes other characters.
    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. Get the security group ID of the instance through the DescribeInstanceSecurityGroup API.
    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 Sample request 1

    This example shows you how to purchase a monthly subscribed TencentDB for Redis 5.0 instance on Memory Edition (Cluster Architecture).

    Input Example

    POST / HTTP/1.1
    Host: redis.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": "154494263",
            "InstanceIds": [
                "crs-h9sn****"
            ],
            "RequestId": "d39baee1-e34f-4685-a810-5d27c510acb3"
        }
    }
    

    Example2 Sample request 2

    This example shows you how to purchase a pay-as-you-go TencentDB for Redis 4.0 instance on Memory Edition (Standard Architecture).

    Input Example

    POST / HTTP/1.1
    Host: redis.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": "22716"
        }
    }
    

    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.