tencent cloud

文档反馈

CreateInstances

最后更新时间:2022-10-13 14:40:39

    1. API Description

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

    This API is used to create a 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. Valid values: 2 (Redis 2.8 Memory Edition in standard architecture), 3 (CKV 3.2 Memory Edition in standard architecture), 4 (CKV 3.2 Memory Edition in cluster architecture), 6 (Redis 4.0 Memory Edition in standard architecture), 7 (Redis 4.0 Memory Edition in cluster architecture), 8 (Redis 5.0 Memory Edition in standard architecture), 9 (Redis 5.0 Memory Edition in cluster architecture), 15 (Redis 6.0 Memory Edition in standard architecture), 16 (Redis 6.0 Memory Edition in cluster architecture)
    MemSize Yes Integer Memory capacity in MB, which must be a multiple of 1,024. It is subject to the purchasable specifications returned by the DescribeProductInfo API.
    If TypeId is the standard architecture, MemSize indicates the total memory capacity of the instance; if TypeId is the cluster architecture, MemSize indicates the memory capacity per shard.
    GoodsNum Yes Integer Number of instances. The actual quantity purchasable at a time is subject to the specifications returned by the DescribeProductInfo API.
    Period Yes Integer Length of purchase in months, which is required when creating a monthly subscribed instance. Valid values: [1,2,3,4,5,6,7,8,9,10,11,12,24,36]. For pay-as-you-go instances, set the 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 password. If the input parameter NoAuth is true and a VPC is used, the Password is optional; otherwise, it is required.
    If the instance TypeId is Redis 2.8, 4.0, or 5.0, the password cannot start with "/" and must contain 8–30 characters in at least two of the following character types: lowercase letters, uppercase letters, digits, and special symbols (()`~!@#$%^&*-+=_
    VpcId No String VPC ID such as vpc-sad23jfdfk. If this parameter is not passed in, the classic network will be selected by default. Use the VPC list querying API to query.
    SubnetId No String In the classic network, subnetId is invalid. In a VPC subnet, the value is the subnet ID, such as subnet-fdj24n34j2.
    ProjectId No Integer Project ID. The value is subject to the projectId returned by user account > user account querying APIs > project list.
    AutoRenew No Integer Auto-renewal flag. 0: default status (manual renewal); 1: auto-renewal enabled; 2: auto-renewal disabled
    SecurityGroupIdList.N No Array of String Array of security group IDs.
    VPort No Integer User-defined port. If this parameter is left empty, 6379 will be used by default. Value range: [1024,65535].
    RedisShardNum No Integer Number of shards in an instance. This parameter is required for Cluster Edition instances. Valid values: [3,5,8,12,16,24,32,64,96,128].
    RedisReplicasNum No Integer Number of replicas in the instance. Redis 2.8 Standard Edition and CKV Standard Edition support 1 replica. Standard/Cluster Edition 4.0 and 5.0 support 1–5 replicas.
    ReplicasReadonly No Boolean Whether to support read-only replicas. Neither Redis 2.8 Standard Edition nor CKV Standard Edition supports read-only replicas. Read/write separation will be automatically enabled for an instance after it enables read-only replicas. Write requests will be directed to the master node and read requests will be distributed to replica nodes. To enable read-only replicas, we recommend you create two or more replicas.
    InstanceName No String Instance name, which can contain up to 60 letters, digits, underscores, or hyphens.
    NoAuth No Boolean Whether to support the password-free feature. Valid values: true (password-free instance), false (password-enabled instance). Default value: false. Only instances in a VPC support the password-free access.
    NodeSet.N No Array of RedisNodeInfo Node information of the instance. Currently, information about the node type (master or replica) and node AZ can be passed in. This parameter is not required for single-AZ deployed instances.
    ResourceTags.N No Array of ResourceTag Tag bound to the instance to be purchased
    ZoneName No String Name of the AZ where the instance resides. For more information, see Regions and AZs.
    TemplateId No String ID of the parameter template applied to the created instance. If this parameter is left blank, the default parameter template will be applied.
    DryRun No Boolean false: send a normal request and create an instance directly after the check is passed (default value); true: send a check request without creating an instance.
    ProductVersion No String Valid values: local (local disk edition), cloud (cloud disk edition), cdc (dedicated cluster edition). Default value: local (local disk edition)
    RedisClusterId No String Dedicated cluster ID, which is required when ProductVersion is "cdc".

    3. Output Parameters

    Parameter Name Type Description
    DealId String Transaction ID
    InstanceIds Array of String Instance ID
    RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

    4. Example

    Example1 Purchasing a pay-as-you-go TencentDB for Redis v4.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.
    联系我们

    联系我们,为您的业务提供专属服务。

    技术支持

    如果你想寻求进一步的帮助,通过工单与我们进行联络。我们提供7x24的工单服务。

    7x24 电话支持