CreateInstances

Last updated: 2020-11-24 17:37:19

1. API Description

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

This API is used to create Redis instances.

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

Note: This API supports Finance regions. If the common parameter Region is a Finance region, a domain name with the Finance region needs to be specified, for example: redis.ap-shanghai-fsi.tencentcloudapi.com

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 parameter. The value used for this API: CreateInstances.
Version Yes String Common parameter. The value used for this API: 2018-04-12.
Region Yes String Common parameter. For more information, please see the list of regions supported by the product.
ZoneId Yes Integer Availability zone ID of the instance. For more information, please see Regions and AZs.
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).
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 indicates the standard architecture, MemSize indicates the total memory capacity of an instance; if TypeId indicates 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 Purchased usage period in months. which is required when creating an instance. For pay-as-you-go instances, the valid value is 1; for monthly subscription instances, the value range is [1,2,3,4,5,6,7,8,9,10,11,12,24,36].
BillingMode Yes Integer Billing method. 0: pay as you go
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 type parameter TypeId indicates Redis 2.8, 4.0, or 5.0, the password cannot start with "/" and must contain 8-30 characters which are comprised of at least two of the following: lowercase letters, uppercase letters, digits, and special symbols (()~!@#$%^&*-+=_&#124;{}[]:;<>,.?/).<br/>If the instance type parameterTypeId` indicates CKV 3.2, the password contains 8-30 characters which must be comprised of only letters and digits.
VpcId No String VPC ID, such as "vpc-sad23jfdfk". If this parameter is not passed in, the classic network will be selected by default. The parameter value can be queried by the DescribeVpcs API.
SubnetId No String In a classic network, subnetId is invalid. In a VPC subnet, the value can be queried by the DescribeSubnets API, such as "subnet-fdj24n34j2".
ProjectId No Integer Project ID. The value is subject to the projectId returned by the DescribeProject API.
AutoRenew No Integer Auto-renewal flag. Valid values: 0 (default status, indicating 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 instances in cluster architecture. Value range: [3,5,8,12,16,24,32,64,96,128].
RedisReplicasNum No Integer Number of replicas in an 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 in standard architecture nor CKV in standard architecture 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 on the replica nodes. To enable read-only replicas, we recommend that you create 2 or more replicas.
InstanceName No String Instance name. It contains only letters, digits, and symbols (-_) with a length of up to 60 characters.
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

3. Output Parameters

Parameter Name Type Description
DealId String Transaction ID
InstanceIds Array of String Instance ID (this field is during beta test and is not displayed in some regions)
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Sample request: purchasing a pay-as-you-go Memory Edition (standard architecture) TencentDB for Redis v4.0 instance

Input Example

https://redis.tencentcloudapi.com/?Action=CreateInstances
&ZoneId=100002
&TypeId=6
&MemSize=1024
&GoodsNum=1
&Period=1
&BillingMode=0
&Password=**********
&<Common request parameters>

Output Example

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

Example2 Sample request: purchasing a monthly subscription Memory Edition (standard architecture) TencentDB for Redis v5.0 instance

Input Example

https://redis.tencentcloudapi.com/?Action=CreateInstances
&ZoneId=200002
&TypeId=9
&MemSize=2048
&GoodsNum=1
&Period=3
&BillingMode=1
&VpcId=vpc-fmh*****
&SubnetId=subnet-680c****
&RedisShardNum=3
&RedisReplicasNum=1
&NoAuth=true
&<Common request parameters>

Output Example

{
  "Response": {
    "DealId": "154494263",
    "InstanceIds": [
      "crs-h9sn****"
    ],
    "RequestId": "d39baee1-e34f-4685-a810-5d27c510acb3"
  }
}

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.SystemError Internal system error, which is irrelevant to the business.
InternalError.InternalError Internal error.
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 Incorrect type of instances requested for purchase (TypeId - 1: cluster edition; 2: primary-secondary edition, i.e., the legacy primary-secondary edition).
InvalidParameterValue.InvalidSubnetId In a VPC, vpcid or subnet ID is invalid.
InvalidParameterValue.PasswordEmpty The password is empty.
InvalidParameterValue.PasswordRuleError When the password is set, the old password passed in by MC does not match the previously set password.
InvalidParameterValue.SecurityGroupIdsNotExists Incorrect request parameter or security group ID.
InvalidParameterValue.UnVpcIdNotExists Invalid VPC subnet ID of uniqVpcId.
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 3 years and exceeds the maximum value.
LimitExceeded.PeriodLessThanMinLimit The length of purchase is invalid. It must be at least one month.
ResourceNotFound.AccountDoesNotExists The uin value is blank.
ResourceNotFound.InstanceNotExists No Redis instance is found by the serialId.
ResourceUnavailable.InstanceDeleted The instance has already been repossessed.
ResourceUnavailable.NoEnoughVipInVPC Insufficient IP resources in the VPC.
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.
UnauthorizedOperation.NoCAMAuthed No CAM permissions.
UnauthorizedOperation.UserNotInWhiteList The user is not in the allowlist.

Was this page helpful?

Was this page helpful?

  • Not at all
  • Not very helpful
  • Somewhat helpful
  • Very helpful
  • Extremely helpful
Send Feedback
Help