You can call this operation to create an ApsaraDB for Redis instance.

For more information about how to perform the corresponding operation in the console, see Create an instance.

For more information about instance types, see Instance types.

Debugging

You can call this operation in OpenAPI Explorer without the need to manually calculate the signature. After you call the operation, OpenAPI Explorer can automatically generate SDK example code.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateInstance

The operation that you want to perform. Set this parameter to CreateInstance.

RegionId String Yes cn-hangzhou

The ID of the region in which the instance is created. You can call the DescribeRegions operation to query the latest region list.

InstanceClass String No redis.master.small.default

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

Note You need to pass at least one of the Capacity and InstanceClass parameters when calling the CreateInstance operation.
Capacity Long No 16384

The storage capacity of the instance. Unit: MB.

Note You need to pass at least one of the Capacity and InstanceClass parameters when calling the CreateInstance operation.
AccessKeyId String No Lxxxxxxxxxxxxxxw

The AccessKey ID that Alibaba Cloud provides for you to access services.

Token String No AAAAAAAAAAAAAAAAAAAAAAAAAA

The token ensuring that making multiple identical requests has the same effect as making a single request. The value of this parameter is generated by the client and must be unique among different requests. The value is case-sensitive and can be up to 64 ASCII characters in length.

InstanceName String No apitest

The name of the instance. The name can be 2 to 128 characters in length and must start with a letter. The following characters are not supported: at signs (@), forward slashes (/), colons (:), equal signs (=), double quotation marks ("), angle brackets (<>), braces ([]), curly brackets ({}) and spaces.

Password String No Acfr5xxx,.xxx

The password of the instance. The password can be 8 to 32 characters in length and must contain at least three types of the following characters: uppercase letters, lowercase letters, digits, and special characters. Special characters include ! at signs (@), number signs (#), dollar signs ($), percent signs (%), carets (^), ampersands (&), asterisks (*), parentheses (()), underscores (_), plus signs (+), hyphens (-), and equal signs (=).

ZoneId String No cn-hangzhou-e

The ID of the zone in which the instance is created. You can call the DescribeRegions operation to query the latest region list.

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 parameter configuration of the instance, in a JSON string. For more information, see Set parameters.

ChargeType String No PostPaid

The billing method of the instance. Valid values:

  • PrePaid: subscription.
  • PostPaid: pay-as-you-go.
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 VPC.

VSwitchId String No vsw-oqscxxxxxxxxxxxxx5e8c

The ID of the VSwitch.

Period String No 12

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

Note This parameter is invalid if the value of the ChargeType parameter is 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 number. Default value: youhuiquan_promotion_option_id_for_blank.

SrcDBInstanceId String No r-bp1xxxxxxxxxxxxxx

The ID of the source instance. You need to specify this parameter if you want to create an instance based on the backup file of a specified instance.

BackupId String No 111111111

The ID of the backup file of the source instance. You need to specify this parameter if you want to create an instance based on the backup file of a specified instance. You can call the DescribeBackups operation to query the IDs of backup files.

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: 2.8.
PrivateIpAddress String No 172.16.0.10

The internal IP address of the instance.

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

Specifies whether to enable auto renewal. Valid values:

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

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

  • 1
  • 2
  • 3
  • 6
  • 12
Note You must specify this parameter if the value of the AutoRenew parameter is true.
AutoUseCoupon String No false

Specifies whether to use a coupon. Valid values:

  • true
  • false
Note Default value: false.

Response parameters

Parameter Type Example Description
Bandwidth Long 32

The bandwidth throttling of the instance. Unit: MByte/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 parameter configuration 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 service port 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 located.

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

The ID of the request.

UserName String r-j6cxxxxxxxxxxxxx

The username for connecting to the instance.

VSwitchId String vsw-oqscxxxxxxxxxxxxxxxxx

The ID of the VSwitch.

VpcId String vpc-bp1xxxxxxxxxxxxxxxxxx

The ID of the VPC.

ZoneId String cn-hongkong-b

The ID of the zone where the instance is located.

Examples

Sample request


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

Sample success response

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",
	"Connections":10000,
	"Bandwidth":32
}

Error codes

HTTP status code 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 verification of the token failed.
400 InvalidInstanceName.Malformed The Specified parameter "InstanceName" is not valid. The error message returned because the verification of the instance name failed.
400 InvalidPassword.Malformed The Specified parameter "Password" is not valid. The error message returned because the verification of the password failed.
400 InsufficientBalance Your account does not have enough balance. The error message returned because your account does not have enough balance. Recharge your account and try it 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 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 in 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 VPC.

For more information, see Error codes.