Creates an ApsaraDB for Redis instance.

Before you call this operation, make sure that you fully understand the billing methods and pricing of ApsaraDB for Redis.

Note For more information about how to create an instance in the ApsaraDB for Redis console, see Create an instance.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateInstance

The operation that you want to perform. Set the value to CreateInstance.

RegionId String Yes cn-hangzhou

The ID of the region where you want to create the ApsaraDB for Redis instance. You can call the DescribeRegions operation to query region IDs.

ZoneId String Yes cn-hangzhou-e

The ID of the zone where you want to create the ApsaraDB for Redis instance. You can call the DescribeRegions operation to query zone IDs.

Token String No AAAAAAAAAAAAAAAAAAAAAAAAAA

The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must ensure that it is unique among different requests. The token is case-sensitive. The token can contain only ASCII characters and cannot exceed 64 characters in length.

InstanceName String No apitest

The name of the ApsaraDB for Redis instance. The name must be 2 to 128 characters in length. The name cannot contain spaces and the following special characters: @ / : = " < > { [ ] }. The name must start with a letter.

Password String No Pass!123456

The password of the ApsaraDB for Redis instance. The password must be 8 to 32 characters in length. The password must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. Special characters include! @ # $ % ^ & * ( ) _ + - =.

Capacity Long No 16384

The storage capacity of the ApsaraDB for Redis instance. Unit: MB.

Note You must set at least one of the Capacity and InstanceClass parameters when you call this operation.
InstanceClass String No redis.master.small.default

The instance type. For more information, see Instance types.

Note You must set at least one of the Capacity and InstanceClass parameters when you call this operation.
Config String No {\"EvictionPolicy\":\"volatile-lru\",\"hash-max-ziplist-entries\":512,\"zset-max-ziplist-entries\":128,\"zset-max-ziplist-value\":64,\"set-max-intset-entries\":512,\"hash-max-ziplist-value\":64}

The configuration of the ApsaraDB for Redis instance, which is a JSON string. For more information, see Parameter overview and configuration guide.

ChargeType String No PostPaid

The billing method of the ApsaraDB for Redis instance. Valid values:

  • PrePaid: subscription
  • PostPaid: pay-as-you-go
Note Default value: PostPaid.
NodeType String No MASTER_SLAVE

The node type of the ApsaraDB for Redis instance. Valid values:

  • STAND_ALONE: standalone
  • MASTER_SLAVE: master-replica
Note Default value: MASTER_SLAVE.
NetworkType String No VPC

The network type of the ApsaraDB for Redis instance. Valid values:

  • CLASSIC: The instance runs in a classic network.
  • VPC: The instance runs in a virtual private cloud (VPC).
Note Default value: CLASSIC.
VpcId String No vpc-bp1nme44gek34slfc****

The ID of the VPC.

VSwitchId String No vsw-bp1e7clcw529l773d****

The ID of the vSwitch.

Period String No 12

The subscription duration. Valid values: 1 to 9, 12, 24, and 36. Unit: months.

Note This parameter is required if the ChargeType parameter is set to PrePaid.
BusinessInfo String No 000000000

The ID of the promotion event or the business information.

CouponNo String No youhuiquan_promotion_option_id_for_blank

The coupon code. Default value: youhuiquan_promotion_option_id_for_blank.

SrcDBInstanceId String No r-bp1zxszhcgatnx****

The ID of the source instance. If you want to create an instance based on the backup of a specified instance, you can set this parameter and set the BackupId or RestoreTime parameter to specify the backup.

BackupId String No 111111111

The ID of the backup file of the source instance. If you want to create an instance based on the backup of a specified instance, you can set this parameter after you set the SrcDBInstanceId parameter. The system creates an instance based on the backup file that is specified by this parameter. You can call the DescribeBackups operation to query the IDs of backup files.

Note After you set the SrcDBInstanceId parameter, you must set the BackupId or RestoreTime parameter to specify the backup.
RestoreTime String No 2019-06-19T16:00:00Z

The point in time at which the specified source instance is backed up. If you want to create an instance based on the backup of a specified source instance at a specified point in time within the retained period, you can set this parameter after you set the SrcDBInstanceId parameter. Then, the system creates a new instance based on the backup of the source instance. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

Note After you set the SrcDBInstanceId parameter, you must set the BackupId or RestoreTime parameter to specify the backup.
InstanceType String No Redis

The engine type of the ApsaraDB for Redis instance. Valid values:

  • Redis
  • Memcache
Note Default value: Redis.
EngineVersion String No 4.0

The engine version of the ApsaraDB for Redis instance. Valid values: 2.8, 4.0, and 5.0.

Note Default value: 5.0.
PrivateIpAddress String No 172.16.0.***

The private IP address of the ApsaraDB for Redis instance.

Note The private IP address must be in the CIDR block of the vSwitch to which the ApsaraDB for Redis instance belongs.
AutoUseCoupon String No false

Specifies whether to use a coupon. Valid values:

  • true: uses the coupon.
  • false: does not use the coupon.
Note Default value: false.
AutoRenew String No true

Specifies whether to enable auto-renewal. Valid values:

  • true: enables auto-renewal.
  • False: disables auto-renewal.
Note Default value: false.
AutoRenewPeriod String No 3

The cycle of the auto-renewal. Unit: months. Valid values: 1, 2, 3, 6, and 12.

Note This parameter is required if AutoRenew is set to true.
ResourceGroupId String No rg-resourcegroupid1

The ID of the resource group.

DedicatedHostGroupId String No dhg-uv4fnk6r7zff****

The ID of the dedicated cluster. This parameter is required if you create an ApsaraDB for Redis instance in a dedicated cluster.

GlobalInstanceId String No gr-bp14rkqrhac****

The ID of the distributed instance. This operation is applicable to only the Alibaba Cloud China site.

GlobalInstance Boolean No false

Specifies whether to use the newly created instance as the first child instance of the distributed instance. Valid values:

  • true: uses the newly created instance as the first child instance
  • false: does not use the newly created instance as the first child instance. This is the default value.
Note
  • If you want to set this parameter to true, you must create a performance-enhanced instance of Enhanced Edition with the major version of Redis 5.0.
  • This operation is applicable to only the Alibaba Cloud China site.

Response parameters

Parameter Type Example Description
Bandwidth Long 32

The bandwidth limit of the ApsaraDB for Redis instance. Unit: Mbit/s.

Capacity Long 16384

The storage capacity of the ApsaraDB for Redis instance. Unit: MB.

ChargeType String PostPaid

The billing method of the ApsaraDB for Redis instance. Valid values:

  • PrePaid: subscription
  • PostPaid: pay-as-you-go
Config String {\"EvictionPolicy\":\"volatile-lru\",\"hash-max-ziplist-entries\":512,\"zset-max-ziplist-entries\":128,\"zset-max-ziplist-value\":64,\"set-max-intset-entries\":512,\"hash-max-ziplist-value\":64}

The configurations of the ApsaraDB for Redis instance.

ConnectionDomain String r-bp1zxszhcgatnx****.redis.rds.aliyuncs.com

The internal endpoint of the ApsaraDB for Redis instance.

Connections Long 10000

The maximum number of connections supported by the ApsaraDB for Redis instance.

EndTime String 2019-01-18T16:00:00Z

The time when the subscription expires. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

InstanceId String r-bp1zxszhcgatnx****

The globally unique identifier (GUID) of the ApsaraDB for Redis instance.

InstanceName String apitest

The name of the ApsaraDB for Redis instance.

InstanceStatus String Creating

The status of the ApsaraDB for Redis instance.

NetworkType String VPC

The network type of the ApsaraDB for Redis instance. Valid values:

  • CLASSIC: The instance runs in a classic network.
  • VPC: The instance runs in a virtual private cloud (VPC).
NodeType String MASTER_SLAVE

The node type of the ApsaraDB for Redis instance. Valid values:

  • STAND_ALONE: standalone
  • MASTER_SLAVE: master-replica
Port Integer 6379

The service port of the ApsaraDB for Redis instance.

PrivateIpAddr String 172.16.0.10

The internal IP address of the ApsaraDB for Redis instance.

QPS Long 100000

The expected maximum queries per second (QPS).

RegionId String cn-hongkong

The region where the ApsaraDB for Redis instance is deployed.

RequestId String 5DEA3CC9-F81D-4387-8E97-CEA40F09****

The ID of the request.

UserName String r-bp1zxszhcgatnx****

The username that is used to connect to the ApsaraDB for Redis instance. By default, ApsaraDB for Redis provides a username that is named after the instance ID.

VSwitchId String vsw-bp1e7clcw529l773d****

The ID of the vSwitch to which the ApsaraDB for Redis instance is connected.

VpcId String vpc-bp1nme44gek34slfc****

The ID of the VPC.

ZoneId String cn-hangzhou-b

The ID of the zone where the ApsaraDB for Redis instance is deployed.

Examples

Sample requests

https://r-kvstore.aliyuncs.com/?Action=CreateInstance
&RegionId=cn-hangzhou
&ZoneId=cn-hangzhou-e
&InstanceClass=redis.master.2xlarge.default
&InstanceName=apitest
&<Common request parameters>

Sample success responses

XML format

<CreateInstanceResponse>
      <ChargeType>PostPaid</ChargeType>
      <Config>{"EvictionPolicy":"volatile-lru","hash-max-ziplist-entries":512,"zset-max-ziplist-entries":128,"zset-max-ziplist-value":64,"set-max-intset-entries":512,"hash-max-ziplist-value":64}</Config>
      <InstanceId>r-bp1zxszhcgatnx****</InstanceId>
      <UserName>r-bp1zxszhcgatnx****</UserName>
      <ZoneId>cn-hangzhou-b</ZoneId>
      <InstanceStatus>Creating</InstanceStatus>
      <Port>6379</Port>
      <QPS>100000</QPS>
      <RequestId>96132219-F1E6-40AB-8853-C32055B8****</RequestId>
      <RegionId>cn-hangzhou</RegionId>
      <Capacity>16384</Capacity>
      <ConnectionDomain>r-bp1zxszhcgatnx****.redis.rds.aliyuncs.com</ConnectionDomain>
      <InstanceName>apitest</InstanceName>
      <Bandwidth>32</Bandwidth>
      <Connections>10000</Connections>
</CreateInstanceResponse>

JSON format

{
    "ChargeType": "PostPaid",
    "Config": "{\"EvictionPolicy\":\"volatile-lru\",\"hash-max-ziplist-entries\":512,\"zset-max-ziplist-entries\":128,\"zset-max-ziplist-value\":64,\"set-max-intset-entries\":512,\"hash-max-ziplist-value\":64}",
    "InstanceId": "r-bp1zxszhcgatnx****",
    "UserName": "r-bp1zxszhcgatnx****",
    "ZoneId": "cn-hangzhou-b",
    "InstanceStatus": "Creating",
    "Port": 6379,
    "QPS": 100000,
    "RequestId": "96132219-F1E6-40AB-8853-C32055B8****",
    "RegionId": "cn-hangzhou",
    "Capacity": 16384,
    "ConnectionDomain": "r-bp1zxszhcgatnx****.redis.rds.aliyuncs.com",
    "InstanceName": "apitest",
    "Bandwidth": 32,
    "Connections": 10000
}

Error codes

HttpCode Error code Error message Description
400 InsufficientBalance Your account does not have enough balance. The error message returned because your account does not have a sufficient balance. Top up your account and try again.
403 RealNameAuthenticationError Your account has not passed the real-name authentication yet. The error message returned because your account has not passed the real-name verification.
400 QuotaExceed.AfterpayInstance Living afterpay instances quota exceeded. The error message returned because the number of instances that you created exceeds the quota.
400 InvalidCapacity.NotFound The Capacity provided does not exist in our records. The error message returned because the specified capacity is invalid.
400 ResourceNotAvailable Resource you requested is not available for finance user. The error message returned because the requested resource is unavailable to users of Alibaba Finance Cloud.
400 PaymentMethodNotFound No payment method has been registered on the account. The error message returned because no payment method is specified for your account.
400 IdempotentParameterMismatch Request uses a client token in a previous request but is not identical to that request. The error message returned because the current request uses a token that has been used in an earlier request but the two requests are not identical.
400 QuotaNotEnough Quota not enough in this zone. The error message returned because the number of instances that you created exceeds the quota for this zone.
400 QuotaExceed Living afterpay instances quota exceed. The error message returned because the number of instances that you created exceeds the quota.
400 IzNotSupportVpcError Specify iz not support vpc. The error message returned because the specified iz does not support VPCs.

For a list of error codes, visit the API Error Center.