Creates an ApsaraDB for Redis instance.
Before you call this operation, make sure that you understand the billing methods and pricing of ApsaraDB for Redis.
You can call this operation to create ApsaraDB for Redis instances that use local or cloud disks and Tair DRAM-based instances that use local disks. To create Tair instances that use cloud disks, call the CreateTairInstance operation.
Debugging
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 instance. You can call the DescribeRegions operation to query the most recent region list. |
Token | String | No | ETnLKlblzczshOTUbOCz**** |
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 make sure 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 instance. The name must be 2 to 80 characters in length and must
start with a letter. It cannot contain spaces or specific special characters. These
special characters include |
Password | String | No | Pass!123456 |
The password that is used to connect to 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 the CreateInstance operation.
|
InstanceClass | String | No | redis.master.small.default |
The instance type of the instance. Example: redis.master.small.default. A redis.master.small.default instance is a 1 GB standard master-replica instance of the Community Edition that uses local disks. For more information, see Overview. Note You must specify at least one of the Capacity and InstanceClass parameters when you call the CreateInstance operation.
|
ZoneId | String | Yes | cn-hangzhou-e |
The primary zone ID of the instance. You can call the DescribeRegions operation to query the most recent zone list. |
ChargeType | String | No | PostPaid |
The billing method of the instance. Default value: PostPaid. Valid values:
Note The default value is PostPaid.
|
NetworkType | String | No | VPC |
The network type of the instance. Set the value to VPC. |
VpcId | String | No | vpc-bp1nme44gek34slfc**** |
The ID of the virtual private cloud (VPC). |
VSwitchId | String | No | vsw-bp1e7clcw529l773d**** |
The ID of the vSwitch to which to connect the instance. |
Period | String | No | 12 |
The subscription duration. Valid values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 24,36, and 60. Unit: months. Note This parameter is valid and required only if the ChargeType parameter is set to PrePaid.
|
BusinessInfo | String | No | 000000000 |
The ID of the promotional event or business information. |
CouponNo | String | No | youhuiquan_promotion_option_id_for_blank |
The coupon code. Default value: |
SrcDBInstanceId | String | No | r-bp1zxszhcgatnx**** |
The ID of the source instance. If you want to create an instance based on a backup file of a specific instance, you can specify this parameter and use the BackupId or RestoreTime parameter to specify the backup file. |
BackupId | String | No | 111111111 |
The ID of the backup file of the source instance. If you want to create an instance based on a backup file of a specific instance, you can set this parameter after you set the SrcDBInstanceId parameter. Then, 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 file.
|
InstanceType | String | No | Redis |
The database engine of the instance. Valid values:
Note The default value is Redis.
|
EngineVersion | String | No | 4.0 |
The database engine version of the instance. Valid values: 4.0, 5.0, 6.0, and 7.0. Note The default value is 5.0.
|
PrivateIpAddress | String | No | 172.16.0.*** |
The private IP address of the instance. Note The private IP address must be available within the CIDR block of the vSwitch to which
to connect the instance.
|
AutoUseCoupon | String | No | false |
Specifies whether to use a coupon. Valid values:
Note The default value is false.
|
AutoRenew | String | No | true |
Specifies whether to enable auto-renewal for the instance. Valid values:
Note The default value is false.
|
AutoRenewPeriod | String | No | 3 |
The auto-renewal period. Unit: months. Valid values: 1, 2, 3, 6, and 12. Note This parameter is required if the AutoRenew parameter is set to true.
|
ResourceGroupId | String | No | rg-resourcegroupid1 |
The ID of the resource group to which to assign the instance. |
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 a backup file of a specific instance, you can set this parameter to specify a point in time after you set the SrcDBInstanceId parameter. Then, the system creates an instance based on the backup file that was created at the specified point in time for 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 file.
|
DedicatedHostGroupId | String | No | dhg-uv4fnk6r7zff**** |
The ID of the dedicated cluster. This parameter is required if you create an instance in a dedicated cluster. |
ShardCount | Integer | No | 4 |
The number of shards. This parameter is available only for cluster instances that use cloud disks. You can use this parameter to specify the number of shards. |
ReadOnlyCount | Integer | No | 5 |
The number of read-only nodes of the instance. This parameter is available only if you create a read/write splitting instance that uses cloud disks. You can use this parameter to specify a custom number of read-only nodes for the instance. Valid value: 1 to 5. |
GlobalInstanceId | String | No | gr-bp14rkqrhac**** |
The ID of the distributed instance. This parameter is available only on the China site (aliyun.com). |
GlobalInstance | Boolean | No | false |
Specifies whether to use the new instance as the first child instance of the distributed instance. Default value: false. Valid values:
Note
|
SecondaryZoneId | String | No | cn-hangzhou-h |
The secondary zone ID of the instance. You can call the DescribeZones operation to query the most recent zone list. Note If you specify this parameter, the master node and replica node of the instance can
be deployed in different zones and disaster recovery is implemented across zones.
The instance can withstand failures in data centers.
|
Port | String | No | 6379 |
The port number of the instance. Valid values: 1024 to 65535. Default value: 6379. |
DryRun | Boolean | No | false |
Specifies whether to conduct a precheck before the system creates the instance. Valid values:
|
Tag.N.Key | String | No | testkey |
The key of tag N. Note
|
Tag.N.Value | String | No | testvalue |
The value of tag N. Note N specifies the serial number of the tag. For example, Tag.1.Value specifies the value of the first tag and Tag.2.Value specifies the value of the second tag.
|
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
VpcId | String | vpc-bp1nme44gek34slfc**** |
The ID of the VPC. |
QPS | Long | 100000 |
The expected maximum queries per second (QPS). |
Capacity | Long | 16384 |
The storage capacity of the instance. Unit: MB. |
ConnectionDomain | String | r-bp1zxszhcgatnx****.redis.rds.aliyuncs.com |
The internal endpoint of the instance. |
ChargeType | String | PostPaid |
The billing method of the instance. Valid values:
|
NetworkType | String | VPC |
The network type of the instance. Valid values:
|
InstanceId | String | r-bp1zxszhcgatnx**** |
The GUID of the instance. |
Port | Integer | 6379 |
The service port of the instance. |
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. |
RegionId | String | cn-hongkong |
The ID of region in which the instance is created. |
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. |
VSwitchId | String | vsw-bp1e7clcw529l773d**** |
The ID of the vSwitch to which the instance is connected. |
RequestId | String | 5DEA3CC9-F81D-4387-8E97-CEA40F09**** |
The ID of the request. |
NodeType | String | MASTER_SLAVE |
The node type. Valid values:
|
Connections | Long | 10000 |
The maximum number of connections supported by the instance. |
Bandwidth | Long | 32 |
The maximum bandwidth of the instance. Unit: MB/s. |
InstanceName | String | apitest |
The name of the instance. |
ZoneId | String | cn-hangzhou-b |
The zone ID of the instance. |
InstanceStatus | String | Creating |
The state of the instance. The return value is Creating. |
PrivateIpAddr | String | 172.16.0.10 |
The private IP address of the instance. |
UserName | String | r-bp1zxszhcgatnx**** |
The username that is used to connect to the instance. By default, ApsaraDB for Redis provides a username that is named after the instance ID. |
OrderId | Long | 2084452111111 |
The ID of the order. |
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
HTTP/1.1 200 OK
Content-Type:application/xml
<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
HTTP/1.1 200 OK
Content-Type:application/json
{
"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
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | InsufficientBalance | Your account does not have enough balance. | The error message returned because your account balance is insufficient. Add funds to your account and try again. |
400 | QuotaExceed.AfterpayInstance | Living afterpay instances quota exceeded. | The error message returned because the maximum number of instances has been reached. |
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 maximum number of instances in this zone has been reached. |
400 | QuotaExceed | Living afterpay instances quota exceed. | The error message returned because the maximum number of instances has been reached. |
400 | IzNotSupportVpcError | Specify iz not support vpc. | The error message returned because the specified iz parameter does not support VPCs. |
403 | RealNameAuthenticationError | Your account has not passed the real-name authentication yet. | The error message returned because your Alibaba Cloud account has not completed real-name verification. |
For a list of error codes, visit the API Error Center.