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.

Note For more information about how to create an instance that meets your requirements in the ApsaraDB for Redis console, see Step 1: Create an ApsaraDB for Redis 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 in which 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 special characters. 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 region list.

ChargeType String No PostPaid

The billing method of the instance. Valid values:

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

The network type of the instance. Valid values:

  • CLASSIC: classic network
  • VPC: 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 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, and 36. Unit: months.

Note This parameter is valid and 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 a backup file of a specified 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 specified 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:

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

The database engine version of the instance. Valid values: 4.0 and 5.0.

Note Default value: 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:

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

Specifies whether to enable auto-renewal for the instance. Valid values:

  • true: enables auto-renewal for the instance.
  • false: disables auto-renewal for the instance.
Note Default value: 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. The point in time must be within the retention period of backup files of the source instance. If you want to create an instance based on a backup file of a specified 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.

GlobalInstanceId String No gr-bp14rkqrhac****

The ID of the distributed instance. This operation is applicable only to 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:

  • true: uses the new instance as the first child instance.
  • false: does not use the new instance as the first child instance.
Note
  • If you want to create a performance-enhanced instance of the ApsaraDB for Redis Enhanced Edition (Tair) that runs Redis 5.0, you must set this parameter to true.
  • This parameter is applicable only to the China site (aliyun.com).
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:

  • true: The system prechecks the request and does not create the instance. The system prechecks the request parameters, request format, service limits, and available resources. If the request fails the precheck, an error message is returned. If the request passes the precheck, the DryRunOperation error code is returned.
  • false: The system sends the request without a precheck. If the request is determined as valid, the system creates the instance.
Tag.N.Key String No testkey

The key of tag N of the instance.

Note
  • N specifies the serial number of the tag. For example, Tag.1.Key specifies the key of the first tag and Tag.2.Key specifies the key of the second tag.
  • If the key of the tag does not exist, the tag is automatically created.
Tag.N.Value String No testvalue

The value of tag N of the instance.

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:

  • PrePaid: subscription
  • PostPaid: pay-as-you-go
NetworkType String VPC

The network type of the instance. Valid values:

  • CLASSIC: classic network
  • VPC: VPC
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 region ID of the 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.

VSwitchId String vsw-bp1e7clcw529l773d****

The ID of the vSwitch to which to connect the instance.

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

The ID of the request.

NodeType String MASTER_SLAVE

The node type. Valid values:

  • STAND_ALONE: standalone
  • MASTER_SLAVE: master-replica
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.

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 Alibaba Cloud 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 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.