tencent cloud

Tencent Cloud Distributed Cache (Redis OSS-Compatible)

CreateInstances

Download
Modo Foco
Tamanho da Fonte
Última atualização: 2026-08-14 16:53:16

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).
  • 19: Valkey 8.0 memory edition (standard architecture).
  • 20: Valkey 8.0 memory edition (cluster architecture).
  • 21: Valkey 9.0 memory edition (standard architecture).
  • 22: Valkey 9.0 memory edition (cluster architecture).
  • 200: Memcached 1.6 memory edition (cluster architecture).
    Note: CKV editions are currently used by some users and are temporarily retained.
MemSize Yes Integer

Memory capacity, measured in MB, must be a multiple of 1024. For specific specifications, query the sales specifications for all regions via the DescribeProductInfo API.

  • When TypeId is standard architecture, MemSize is the total memory capacity of the instance.
  • When TypeId is cluster architecture, MemSize is the sharded memory capacity.
GoodsNum Yes Integer

Instance count. Number of instances to purchase at a time. For details, query sales specifications in all regions via the DescribeProductInfo API.

Period Yes Integer

Duration of instance purchase.

  • If BillingMode is 1, that is, the billing mode is monthly subscription, you need to set this parameter to specify the duration of instance purchase. Measurement unit: month, permissible range [1,2,3,4,5,6,7,8,9,10,11,12,24,36].
  • If BillingMode is 0, that is, the billing mode is pay-as-you-go, set this parameter to 1.
BillingMode Yes Integer

Billing mode.

  • 0: Pay-As-You-Go.
  • 1: Monthly Subscription.
ZoneId No Integer

ID of the AZ to which the instance belongs. See Regions and AZs.

Password No String

Password for accessing instances.

  • When the input parameter NoAuth is true, it means setting instances to Password-free access, and Password does not need to be configured. Otherwise, Password is required.
  • When the instance type TypeId is Redis 2.8 memory edition standard architecture, Redis 4.0, 5.0, 6.2, or 7.0 memory edition standard architecture or cluster architecture, the Password complexity requirements are: 8-64 characters, containing at least lowercase letters, uppercase letters, digits, and 2 of the following characters: ()`~!@#$%^&*-+=_|{}[]:;<>,.?/, and cannot start with "/".
  • When the instance type TypeId is CKV 3.2 memory edition standard architecture or cluster architecture, the Password complexity is: 8-30 characters, must include letters and digits, and exclude other characters.
VpcId No String

VPC ID. If you do not configure this parameter, the basic network is selected by default. Log in to the private network console to query the specific ID.

SubnetId No String

Subnet of the private network VPC. In the basic network, this parameter requires no configuration. Log in to the Private Network console to query the subnet list and obtain the specific ID.

ProjectId No Integer

Project ID. Log in to the Redis console, select Project Management from the account information menu in the top-right corner, and query the project ID.

AutoRenew No Integer

Automatic renewal flag.

  • 0: default status (manual renewal).
  • 1: automatic renewal.
  • 2: non-renewal upon expiration.
SecurityGroupIdList.N No Array of String

Security group ID array.

  • A security group is a virtual firewall that controls network access to a cloud database instance. When creating an instance, it is recommended to bind the corresponding security group.
  • Get the security group ID of an instance through the DescribeInstanceSecurityGroup API.
VPort No Integer

User-defined network port. Defaults to 6379, range [1024,65535].

RedisShardNum No Integer

Number of instance shards.

  • No need to configure this parameter for standard edition instances.
  • For cluster edition instances, the shard quantity range is: [1, 3, 5, 8, 12, 16, 24, 32, 40, 48, 64, 80, 96, 128].
RedisReplicasNum No Integer

Instance replica number.

  • Redis Memory Edition 4.0, 5.0, 6.2, and 7.0 cluster architecture supports a replica quantity range of [1,5].
  • Redis 2.8 Standard Edition and CKV Standard Edition support only 1 replica.
ReplicasReadonly No Boolean

Flag whether the instance needs to support read-only replica.

  • Redis 2.8 Standard Edition and CKV Standard Edition do not support read-only replica.
  • If read-only replica is enabled, the instance will automatically separate read and write operations, with write requests routed to the primary node and read requests routed to replica nodes.
  • If needed to enable read-only replica, it is recommended to have at least 2 replicas.
InstanceName No String

Instance name. Naming requirement: It only supports Chinese characters, letters, numbers, hyphens ("-"), or underscores ("_"), with a length of less than 60.

NoAuth No Boolean

Configure whether the instance supports password-free access.

  • true: Access the instance without a password.
  • false: Access the instance with a password. By default, password access is enabled. Only instances in a VPC network support password-free access.
NodeSet.N No Array of RedisNodeInfo

Node information of instance, including node ID, node type, node availability zone ID. For details, please see RedisNodeInfo.
Currently support inputting node type (primary node or replica node) and availability zone. When this parameter is not specified, in regions that support multi-availability zone deployment, the system defaults to creating instances with multi-availability zone architecture.

ResourceTags.N No Array of ResourceTag

Set a tag for the instance.

ZoneName No String

Specify the name of the AZ to which the instance belongs. For details, see Regions and AZs.

TemplateId No String

Parameter template ID of the specified instance.

  • If this parameter is not configured, the system will automatically adapt to the corresponding default template based on the selected compatible version and architecture.
  • Query the parameter template list of the instance through the DescribeParamTemplates API to obtain the template ID number.
DryRun No Boolean

Internal parameter to identify whether creating an instance needs to check.

  • false: Default value. Send a normal request and create the instance directly after passing the check.
  • true: Send a check request without creating an instance.
ProductVersion No String

Indicates the instance deployment mode.

  • local: traditional architecture, defaults to local.
  • cdc: dedicated cluster.
  • cloud: cloud native, currently not available for sale.
RedisClusterId No String

Dedicated cluster ID.

  • When ProductVersion is set to cdc, this parameter must be set.
  • Get cluster ID through the API DescribeRedisClusters.
AlarmPolicyList.N No Array of String

Alarm policy ID array.

EncryptPassword No Boolean

Whether to enable password encryption for transmission.

  • true: Encrypted.
  • false: Not encrypted (default value).
PasswordPolicy No PasswordPolicy

Instance-level password complexity policy. When not passed in or Enabled=false, deem as not enabling policy, validate by system default rule.

EnableSSL No Boolean

Whether to enable SSL encryption.

  • true: Enable.
  • false: Disable (default value).
SSLBindPrivateIPv4 No Boolean

Whether to write the private IPv4 address of an instance to the domain alias (SAN) of the certificate when SSL is enabled. This parameter is valid only when EnableSSL is true.

  • true: Allows using private IP to perform SSL certificate verification.
  • false: Does not add the SAN extended information to the certificate.
ConnectionMode No Integer

Instance connectivity access Mode.

  • 0: Proxy Mode (default value).
  • 1: Direct access Mode.

3. Output Parameters

Parameter Name Type Description
InstanceIds Array of String

Instance ID.

DealName String

Order 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 Creating an instance request

Input Example

POST / HTTP/1.1
Host: redis.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateInstances
<Common request parameters>

{
    "TypeId": 18,
    "MemSize": 1024,
    "GoodsNum": 1,
    "Period": 1,
    "BillingMode": 0,
    "ZoneId": 100002,
    "Password": "******MyP*ssword",
    "VpcId": "vpc-pxyz****",
    "SubnetId": "subnet-26qr****",
    "RedisShardNum": 3,
    "RedisReplicasNum": 1,
    "NodeSet": [
        {
            "NodeId": 675,
            "NodeType": 0,
            "ZoneId": 100002,
            "ZoneName": "ap-guangzhou-2"
        },
        {
            "NodeId": 676,
            "NodeType": 1,
            "ZoneId": 100003,
            "ZoneName": "ap-guangzhou-3"
        }
    ],
    "ResourceTags": [
        {
            "TagKey": null,
            "TagValue": null
        }
    ],
    "DryRun": false,
    "ConnectionMode": 1
}

Output Example

{
    "Response": {
        "DealId": "20250825297021530591847",
        "RequestId": "e546784b-709c-401d-aba6-73037eb4e522",
        "InstanceIds": [
            "crs-bzss****"
        ]
    }
}

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.SpecNotExist The instance specification doesn’t exist.
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.

Ajuda e Suporte

Esta página foi útil?

comentários