tencent cloud



Last updated: 2022-06-23 15:19:08

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.

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).
MemSize Yes Integer Instance capacity in MB. The value should be a multiple of 1,024 and is subject to the specifications returned by the DescribeProductInfo API.
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
ZoneId No Integer Availability zone ID of the instance. For more information, please 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 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 parameter TypeId` 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 Node information of an instance. Currently, information about the node type (master or replica) and node availability zone can be passed in. This parameter is not required for instances deployed in a single availability zone.
ResourceTags.N No Array of ResourceTag The tag bound with 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.

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 Sample request: purchasing a pay-as-you-go Memory Edition (standard architecture) TencentDB for Redis v4.0 instance

Input Example

&<common request parameters>

Output Example

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

Example2 Sample request: purchasing a monthly-subscribed Memory Edition (cluster architecture) TencentDB for Redis v5.0 instance

Input Example

&<common request parameters>

Output Example

  "Response": {
    "DealId": "154494263",
    "InstanceIds": [
    "RequestId": "d39baee1-e34f-4685-a810-5d27c510acb3"

5. Developer Resources


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 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.
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