Creates an ApsaraDB for Redis instance.

For more information about how to create an instance in the 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 region ID of the instance. You can call the DescribeRegions operation to query the region where the instance can be deployed.

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 and can contain only ASCII characters. It must not exceed 64 characters in length.

InstanceName String No apitest

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

Password String No Acfr5xxx,.xxx

The password of the instance. The password must be 8 to 32 characters in length and 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 instance. Unit: MB.

Note You must specify 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 specify at least one of the Capacity and InstanceClass parameters when you call this operation.
ZoneId String No cn-hangzhou-e

The ID of the zone. You can call the DescribeRegions operation to query the zone where the instance can be created.

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 instance, which is a JSON string. For more information, see Parameter overview and configuration guide.

ChargeType String No PostPaid

The billing method of the instance. Valid values:

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

The node type of the instance. Valid values:

  • STAND_ALONE
  • MASTER_SLAVE
Note Default value: MASTER_SLAVE.
NetworkType String No VPC

The network type of the instance. Valid values:

  • CLASSIC
  • VPC
Note Default value: CLASSIC.
VpcId String No vpc-bp1oxxxxxxxxxxgzv26cf

The ID of the virtual private cloud (VPC) network.

VSwitchId String No vsw-oqscxxxxxxxxxxxxx5e8c

The ID of the VSwitch.

Period String No 12

The subscription period. You must specify this parameter if the ChargeType parameter is set to PrePaid. Valid values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 24, and 36. Unit: months.

Note This parameter is invalid if you set the ChargeType parameter to PostPaid.
BusinessInfo String No 000000000

The ID of the 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-bp1xxxxxxxxxxxxxx

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

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 specify this parameter after you specify the SrcDBInstanceId parameter. The system creates an instance based on the backup file that is specified by these parameters. You can call the DescribeBackups operation to query the IDs of backup files.

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

The point in time of a backup file. If you want to create an instance based on the backup file of a specified source instance at a specified point in time within the retained period, you can specify this parameter after you specify the SrcDBInstanceId parameter. Then, the system creates a new instance from the point-in-time 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 If you specify the SrcDBInstanceId parameter, you must specify the BackupId or RestoreTime parameter.
InstanceType String No Redis

The engine type of the instance. Valid values:

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

The engine version of the instance. Valid values:

  • 2.8
  • 4.0
  • 5.0
Note Default value: 5.0.
PrivateIpAddress String No 172.16.0.10

The internal IP address of the instance.

Note The internal IP address must be in the Classless Inter-Domain Routing (CIDR) block of the VSwitch to which the instance belongs.
AutoUseCoupon String No false

Specifies whether to use a coupon. Valid values:

  • true
  • false
Note Default value: false.
AutoRenew String No true

Specifies whether to enable auto renewal. Valid values:

  • true
  • false
Note Default value: false.
AutoRenewPeriod String No 3

The cycle of the auto renewal. Unit: months. Valid values:

  • 1
  • 2
  • 3
  • 6
  • 12
Note This parameter is required when the AutoRenew parameter is set to true.
ResourceGroupId String No rg-resourcegroupid1

The ID of the resource group.

DedicatedHostGroupId String No dhg-4n********

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

Response parameters

Parameter Type Example Description
Bandwidth Long 32

The bandwidth throttling of the instance. Unit: MB/s.

Capacity Long 16384

The storage capacity of the instance. Unit: MB.

ChargeType String PostPaid

The billing method of the instance. Valid values: PrePaid and PostPaid. Default value: PostPaid.

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

ConnectionDomain String r-j6cxxxxxxxxxxxxx.redis.rds.aliyuncs.com

The internal endpoint of the instance.

Connections Long 10000

The maximum number of connections supported by the instance.

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

The time when the subscription instance 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-j6cxxxxxxxxxxxxx

The globally unique identifier (GUID) of the instance.

InstanceName String apitest

The name of the instance.

InstanceStatus String Creating

The status of the instance.

NetworkType String VPC

The network type of the instance. Valid values:

  • CLASSIC
  • VPC
Note Default value: CLASSIC.
NodeType String MASTER_SLAVE

The node type of the instance. Valid values:

  • STAND_ALONE
  • MASTER_SLAVE
Note Default value: MASTER_SLAVE.
Port Integer 6379

The port number of the instance.

PrivateIpAddr String 172.16.0.10

The internal IP address of the instance.

QPS Long 100000

The theoretical maximum queries per second (QPS).

RegionId String cn-hongkong

The region where the instance is deployed.

RequestId String 5DEA3CC9-F81D-4387-8E97-CEA40F09244D

The ID of the request.

UserName String r-j6cxxxxxxxxxxxxx

The username that is used to connect to the instance.

VSwitchId String vsw-oqscxxxxxxxxxxxxxxxxx

The ID of the VSwitch.

VpcId String vpc-bp1xxxxxxxxxxxxxxxxxx

The ID of the VPC network.

ZoneId String cn-hongkong-b

The ID of the zone where the instance is deployed.

Examples

Sample requests

https://r-kvstore.aliyuncs.com/
? Action=CreateInstance
&RegionId=cn-hongkong
&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-j6cxxxxxxxxxxxxx</InstanceId>
	  <UserName>r-j6cxxxxxxxxxxxxx</UserName>
	  <ZoneId>cn-hongkong-b</ZoneId>
	  <InstanceStatus>Creating</InstanceStatus>
	  <Port>6379</Port>
	  <QPS>100000</QPS>
	  <RequestId>96132219-F1E6-40AB-8853-C32055B84BE1</RequestId>
	  <RegionId>cn-hongkong</RegionId>
	  <Capacity>16384</Capacity>
	  <ConnectionDomain>r-j6cxxxxxxxxxxxxx.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-j6cxxxxxxxxxxxxx",
    "UserName": "r-j6cxxxxxxxxxxxxx",
    "ZoneId": "cn-hongkong-b",
    "InstanceStatus": "Creating",
    "Port": 6379,
    "QPS": 100000,
    "RequestId": "96132219-F1E6-40AB-8853-C32055B84BE1",
    "RegionId": "cn-hongkong",
    "Capacity": 16384,
    "ConnectionDomain": "r-j6cxxxxxxxxxxxxx.redis.rds.aliyuncs.com",
    "InstanceName": "apitest",
    "Bandwidth": 32,
    "Connections": 10000
}

Error codes

HttpCode Error code Error message Description
400 MissingParameter Period is mandatory for this action. The error message returned because the instance ID is required.
400 InvalidToken.Malformed The Specified parameter "Token" is not valid. The error message returned because the token is invalid.
400 InvalidInstanceName.Malformed The Specified parameter "InstanceName" is not valid. The error message returned because the instance name is invalid.
400 InvalidPassword.Malformed The Specified parameter "Password" is not valid. The error message returned because the password verification failed.
400 InsufficientBalance Your account does not have enough balance. The error message returned because your account does not have enough 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 did not pass the real-name verification.
400 QuotaExceed.AfterpayInstance Living afterpay instances quota exceeded. The error message returned because the number of instances you created exceeds the quota of instances.
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 a finance user.
400 PaymentMethodNotFound No payment method has been registered on the account. The error message returned because no payment method has been registered 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 you created exceeds the quota for this zone.
400 QuotaExceed Living afterpay instances quota exceed. The error message returned because the number of instances you created exceeds the quota of instances.
400 VpcServiceError Invoke vpc service failed. The error message returned because calling the VPC service failed.
400 IzNotSupportVpcError Specify iz not support vpc. The error message returned because the specified iz does not support the VPC network.

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