Creates an open-source Redis classic architecture instance, an open-source Redis cloud-native architecture instance, or a Tair memory-optimized classic architecture instance. To create a cloud-native Tair instance, call the CreateTairInstance operation.
Operation description
Before you invoke this operation, make sure that you fully understand the billing methods and pricing of the ApsaraDB for Tair (Redis OSS-compatible) database.
This operation creates open-source Redis instances and Tair memory-optimized classic instances. To create a cloud-native Tair instance, invoke the CreateTairInstance operation.
For information about how to create an instance in the console and select an instance type, see Create a Redis instance.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
kvstore:CreateInstance |
create |
*DBInstance
|
|
None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
Yes |
The region ID. You can call the DescribeRegions operation to query available regions. Set this parameter to the region where you want to create the instance. |
cn-hangzhou |
| Token |
string |
No |
The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token is case-sensitive and can be up to 64 ASCII characters in length. |
ETnLKlblzczshOTUbOCz**** |
| InstanceName |
string |
No |
The name of the instance. The name must be 2 to 80 characters in length, and start with a letter or a Chinese character. It cannot contain spaces or the following special characters: |
apitest |
| Password |
string |
No |
The password of the instance. The password must be 8 to 32 characters in length and contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. Allowed special characters include |
Pass!123456 |
| Capacity |
integer |
No |
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. |
16384 |
| InstanceClass |
string |
No |
The instance type. For example, redis.master.small.default indicates a 1 GB standard master-replica instance of the Community Edition (classic architecture). For more information, see Overview of instance types. Note
You must specify at least one of the Capacity and InstanceClass parameters when you call this operation. |
redis.master.small.default |
| ZoneId |
string |
No |
The primary active zone ID. You can call the DescribeRegions operation to query the most recent zone list. You can use this parameter to specify the zone where you want to create the instance. Note
You can also specify the SecondaryZoneId parameter to set the secondary zone. The deployment of the primary and secondary nodes in the specified primary and secondary zones implements a dual-data-center primary/secondary architecture. For example, you can set ZoneId to "cn-hangzhou-h" and SecondaryZoneId to "cn-hangzhou-g". |
cn-hangzhou-h |
| SecondaryZoneId |
string |
No |
The secondary zone ID. You can call the DescribeZones operation to query the most recent zone list. Note
The value of this parameter cannot be the same as the value of the ZoneId parameter, and cannot be the ID of a multi-zone deployment. |
cn-hangzhou-g |
| ChargeType |
string |
No |
The billing method. Valid values:
|
PostPaid |
| NodeType |
string |
No |
The node type. Valid values:
Note
For cloud-native instances, select MASTER_SLAVE or STAND_ALONE. For classic instances, select double or single. |
STAND_ALONE |
| NetworkType |
string |
No |
The network type. Valid values:
|
VPC |
| VpcId |
string |
No |
The VPC ID. |
vpc-bp1nme44gek34slfc**** |
| VSwitchId |
string |
No |
The vSwitch ID. |
vsw-bp1e7clcw529l773d**** |
| Period |
string |
No |
The subscription period. Unit: months. Valid values: 1 to 9, 12, 24, 36, and 60. Note
This parameter is valid and required only when the ChargeType parameter is set to PrePaid. |
12 |
| BusinessInfo |
string |
No |
The activity ID and business information. |
000000000 |
| CouponNo |
string |
No |
The coupon code. Default value: |
youhuiquan_promotion_option_id_for_blank |
| SrcDBInstanceId |
string |
No |
The ID of the source instance. If you want to create a new instance based on a backup set of a source instance, specify the source instance ID. You can specify a single ID or an array of IDs. Note
Then, specify the backup set or point in time by using the BackupId, ClusterBackupId (recommended for cloud-native cluster architecture), or RestoreTime parameter. This parameter must be used in combination with one of the preceding three parameters. |
r-bp1zxszhcgatnx**** |
| BackupId |
string |
No |
The ID of the backup set of the source instance. The system uses the data in the backup set to create the new instance. You can invoke the DescribeBackups operation to query the backup set ID. If the source instance is a cluster instance, you must enter the backup set IDs of all shards in the source instance and separate them with commas, such as "10**,11**,15**". Note
If your instance is a cloud-native architecture cluster instance, we recommend that you invoke the DescribeClusterBackupList operation to query the cluster backup set ID, such as "cb-xx", and then specify the ClusterBackupId request parameter to clone the cluster instance. This saves you the trouble of entering the backup set ID of each shard. |
111111111 |
| InstanceType |
string |
No |
The instance type. Valid values:
|
Redis |
| EngineVersion |
string |
No |
The engine version of the Redis classic instance. Valid values:
The engine version of the Redis cloud-native instance. Valid values:
Note
Default value: 5.0. Valid values:
|
5.0 |
| PrivateIpAddress |
string |
No |
The internal network IP address of the new instance. Note
The internal network IP address must be within the vSwitch CIDR block of the vSwitch to which the instance belongs. |
172.16.0.*** |
| AutoUseCoupon |
string |
No |
Specifies whether to use a voucher. Valid values:
|
false |
| AutoRenew |
string |
No |
Specifies whether to enable auto-renewal. Valid values:
|
true |
| AutoRenewPeriod |
string |
No |
The auto-renewal epoch. Unit: months. Valid values: 1, 2, 3, 6, and 12. Note
This parameter is required only when the AutoRenew parameter is set to true. |
3 |
| ResourceGroupId |
string |
No |
The resource group ID. |
rg-resourcegroupid1 |
| RestoreTime |
string |
No |
The point in time to which you want to restore the source instance. If the data flashback feature is enabled for the source instance, you can specify a point in time within the backup retention period of the source instance. The system uses the backup data of the source instance at the specified point in time to create the new instance. Specify the time in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC. |
2019-06-19T16:00:00Z |
| DedicatedHostGroupId |
string |
No |
The dedicated cluster ID. This parameter is required when you create an instance in a dedicated cluster. |
dhg-uv4fnk6r7zff**** |
| ShardCount |
integer |
No |
The number of shards. This parameter applies only to cloud-native instances. You can use this parameter to customize the number of shards.
|
4 |
| ReplicaCount |
integer |
No |
The number of secondary nodes in the primary zone. This parameter applies only to cloud-native cluster multi-replica instances. You can use this parameter to customize the number of secondary nodes. Valid values: 1 to 4. Note
If you create a multi-zone instance, you can use this parameter and the SlaveReplicaCount parameter to customize the number of secondary nodes in the primary and secondary zones. The sum of this parameter and the SlaveReplicaCount parameter cannot exceed 4. |
2 |
| SlaveReplicaCount |
integer |
No |
The number of secondary nodes in the secondary zone. |
2 |
| ReadOnlyCount |
integer |
No |
The number of read-only nodes in the primary zone. This parameter applies only to cloud-native read/write splitting instances.
Note
If you create a multi-zone instance, you can use this parameter and the SlaveReadOnlyCount parameter to customize the number of read-only nodes in the primary and secondary zones.
|
2 |
| SlaveReadOnlyCount |
integer |
No |
The number of read-only nodes in the secondary zone. |
2 |
| GlobalInstanceId |
string |
No |
The distributed instance ID. This parameter applies only to the China site. |
gr-bp14rkqrhac**** |
| GlobalInstance |
boolean |
No |
Specifies whether to use the new instance as the first child instance of a distributed instance. You can create a distributed instance in this way. Valid values:
Note
|
false |
| Port |
string |
No |
The service port of the instance. Valid values: 1 to 65535. Default value: 6379. |
6379 |
| DryRun |
boolean |
No |
Specifies whether to perform a dry run before creating the instance. Valid values:
|
false |
| GlobalSecurityGroupIds |
string |
No |
The global IP address whitelist templates of the instance. Separate multiple templates with commas (,). Duplicates are not allowed. Important This parameter applies only to cloud-native instances. Classic instances do not support the whitelist template feature. |
g-zsldxfiwjmti0kcm**** |
| Appendonly |
string |
No |
The Append Only File (AOF) parameter settings of the new instance. Valid values:
Note
This parameter applies to classic instances. Cloud-native instances do not support specifying the AOF parameter. Valid values:
|
yes |
| ConnectionStringPrefix |
string |
No |
The prefix of the endpoint. The prefix must be 8 to 40 characters in length, and can contain lowercase letters and digits. It must start with a lowercase letter. Note
The endpoint format is: |
r-bp1zxszhcgatnx**** |
| ParamGroupId |
string |
No |
The parameter template ID, which is globally unique. Important This parameter is supported only by cloud-native instances. |
rpg-test** |
| Tag |
array<object> |
No |
The tag information of the instance. |
|
|
object |
No |
The tag. |
||
| Key |
string |
No |
The label key. Note
|
testkey |
| Value |
string |
No |
The tag value. Note
N indicates the sequence number of the tag value. For example, Tag.1.Value indicates the value of the first tag, and Tag.2.Value indicates the value of the second tag. |
testvalue |
| ClusterBackupId |
string |
No |
The cluster backup set ID. Some new cluster architectures support this parameter. You can call the DescribeClusterBackupList operation to obtain the ID.
|
cb-hyxdof5x9kqb**** |
| RecoverConfigMode |
string |
No |
Specifies whether to restore the account, kernel parameters, and whitelist information from the original backup set when you create an instance by using a specified backup set. For example, to restore the account information, set the value to account. Default value: empty, which indicates that the account, kernel parameters, and whitelist information are not restored from the original backup set. Note
This parameter applies only to cloud-native instances, and requires that the account, kernel parameters, and whitelist information are saved in the original backup set. You can call the DescribeBackups operation to query whether the RecoverConfigMode parameter of a specified backup set contains the preceding information. |
whitelist,config,account |
| InstanceEndpointType |
string |
No |
The endpoint type used when you create a cloud-native dual-active zone read/write splitting instance. If this parameter is not explicitly specified, the default value is AzIndependentEndpoint.
Important This parameter applies only to cloud-native dual-active zone read/write splitting instances. For other types of instances, only zone-independent endpoints are supported. Even if you specify UnifiedEndpoint, it does not take effect. Important The UnifiedEndpoint parameter is currently available only to whitelisted users. If a non-whitelisted user specifies this parameter, an error is returned. To apply for the permissions, submit a ticket. |
AzIndependentEndpoint |
| MaintainStartTime |
string |
No |
Settings for the start time of the maintenance window for the instance. Specify the time in the HH:mmZ format. The time must be in UTC. For example, if you want the maintenance window to start at 01:00 UTC+8, set the value to Note
If you do not specify this parameter, the default value is 02:00 UTC+8, which is 18:00 UTC. |
03:00Z |
| MaintainEndTime |
string |
No |
Settings for the end time of the maintenance window for the instance. Specify the time in the HH:mmZ format. The time must be in UTC. For example, if you want the maintenance window to end at 02:00 UTC+8, set the value to Note
The interval between the start time and the end time must be at least 1 hour. Note
If you do not specify this parameter, the default value is 06:00 UTC+8, which is 22:00 UTC. |
07:00Z |
The following is a sample request for creating a Redis 7.0 cluster instance.
{
"RegionId": "cn-shenzhen",
"InstanceName": "apitest",
"Password": "D****23",
"ZoneId": "cn-shenzhen-f",
"ChargeType": "PrePaid",
"InstanceClass": "redis.shard.with.proxy.small.ce",
"NetworkType": "VPC",
"Period": "1",
"InstanceType": "Redis",
"EngineVersion": "7.0",
"ShardCount": 4,
"SourceIp": "10.10.10.10"
}
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The object. |
||
| Bandwidth |
integer |
The bandwidth limit of the instance. Unit: MB/s. |
32 |
| Capacity |
integer |
The storage capacity of the instance. Unit: MB. |
16384 |
| ChargeType |
string |
The billing method. Valid values:
|
PostPaid |
| Config |
string |
The detailed configurations of the instance. |
{\"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} |
| ConnectionDomain |
string |
The internal network connection endpoint of the Redis instance. |
r-bp1zxszhcgatnx****.redis.rds.aliyuncs.com |
| Connections |
integer |
The maximum number of connections to the instance. |
10000 |
| EndTime |
string |
The time when the upfront instance expires. Specify the time in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC. |
2019-01-18T16:00:00Z |
| InstanceId |
string |
The instance ID, which is globally unique. |
r-bp1zxszhcgatnx**** |
| InstanceName |
string |
The instance name. |
apitest |
| InstanceStatus |
string |
The current status of the instance. The return value is fixed to Creating. |
Creating |
| NetworkType |
string |
The network type. Valid values:
|
VPC |
| NodeType |
string |
The node type. Valid values:
|
MASTER_SLAVE |
| OrderId |
integer |
The order ID. |
2084452111111 |
| Port |
integer |
The Redis service port. |
6379 |
| PrivateIpAddr |
string |
The internal IP address of the instance. |
172.16.0.10 |
| QPS |
integer |
The queries per second (QPS). This is the theoretical value for the current instance type. |
100000 |
| RegionId |
string |
The region where the instance resides. |
cn-hongkong |
| RequestId |
string |
The request ID. |
5DEA3CC9-F81D-4387-8E97-CEA40F09**** |
| UserName |
string |
The username used to connect to Redis. By default, an account named after the instance ID is included. |
r-bp1zxszhcgatnx**** |
| VSwitchId |
string |
The vSwitch ID. |
vsw-bp1e7clcw529l773d**** |
| VpcId |
string |
The VPC ID. |
vpc-bp1nme44gek34slfc**** |
| ZoneId |
string |
The zone ID of the instance. |
cn-hangzhou-b |
Examples
Success response
JSON format
{
"Bandwidth": 32,
"Capacity": 16384,
"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}",
"ConnectionDomain": "r-bp1zxszhcgatnx****.redis.rds.aliyuncs.com",
"Connections": 10000,
"EndTime": "2019-01-18T16:00:00Z",
"InstanceId": "r-bp1zxszhcgatnx****",
"InstanceName": "apitest",
"InstanceStatus": "Creating",
"NetworkType": "VPC",
"NodeType": "MASTER_SLAVE",
"OrderId": 2084452111111,
"Port": 6379,
"PrivateIpAddr": "172.16.0.10",
"QPS": 100000,
"RegionId": "cn-hongkong",
"RequestId": "5DEA3CC9-F81D-4387-8E97-CEA40F09****",
"UserName": "r-bp1zxszhcgatnx****",
"VSwitchId": "vsw-bp1e7clcw529l773d****",
"VpcId": "vpc-bp1nme44gek34slfc****",
"ZoneId": "cn-hangzhou-b"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | ZoneIdNotFound | Specify iz not support switch network. | Unable to find Availability Zone |
| 400 | InvalidShardInfo.Format | Shard total number is out of range. | |
| 400 | InvalidInstancelevel | Specified Instance level dose not match gdc other member instance level. | |
| 400 | InvalidBackupLogStatus | Backup logs are not enabled for the specified source instance. | |
| 400 | InvalidStatus | Specified instance status is Modifying. | Specified instance status is Modifying. |
| 400 | SecurityRisk.AuthVerification | we have detected a risk with your default payment method. An email and notification has been sent to you. Please re-submit your order before after verificaiton. | |
| 400 | MissingParameter | Period is mandatory for this action. | |
| 400 | InvalidToken.Malformed | The Specified parameter Token is not valid. | |
| 400 | InvalidInstanceName.Malformed | The Specified parameter InstanceName is not valid. | |
| 400 | InvalidPassword.Malformed | The Specified parameter Password is not valid. | |
| 400 | InsufficientBalance | Your account does not have enough balance. | |
| 400 | QuotaExceed.AfterpayInstance | Living afterpay instances quota exceeded. | |
| 400 | InvalidCapacity.NotFound | The Capacity provided does not exist in our records. | |
| 400 | ResourceNotAvailable | Resource you requested is not available for finance user. | |
| 400 | PaymentMethodNotFound | No payment method has been registered on the account. | |
| 400 | IdempotentParameterMismatch | Request uses a client token in a previous request but is not identical to that request. | Idempotent check. |
| 400 | QuotaNotEnough | Quota not enough in this zone. | |
| 400 | QuotaExceed | Living afterpay instances quota exceed. | |
| 400 | VpcServiceError | Invoke vpc service failed. | |
| 400 | IzNotSupportVpcError | Specify iz not support vpc. | |
| 400 | InvalidvSwitchId | The vpc does not cover the vswitch. | |
| 400 | InvalidIzNo.NotSupported | The Specified vpc zone not supported. | |
| 400 | InvalidAccountPassword.Format | Specified account password is not valid. | |
| 400 | InstanceClass.NotMatch | Current instance class and instance type is not match. | |
| 400 | InvalidVPCId.NotFound | Specified virtual vpc is not found. | The specified VPC is not found. Check whether the VPC ID is correct. |
| 400 | AccountMoneyValidateError | Account money validate error. | |
| 400 | RequestTokenConflict | Specified request token conflict. | |
| 400 | InvalidIPNotInSubnet | Error ip not in subnet. | |
| 400 | InvalidEngineVersion.Malformed | Specified engine version is not valid. | The error message returned because the instance engine version is invalid. |
| 400 | Zone.Closed | The specified zone is closed. | |
| 400 | VSwithNotBelongToNotVpcFault | The vSwitch does not belong to current vpc. | |
| 400 | PayIllegalAgreement | Pay mayi with holding agreement illegal. | |
| 400 | IllegalParamError | validateSaleConditionWithSubArticle failed. | |
| 400 | CASH_BOOK_INSUFFICIENT | No payment method is specified for your account. We recommend that you add a payment method or maitain a minimum prepayment balance of INR 1000. | |
| 400 | InvalidRegion.Format | Specified Region is not valid. | The specified region is invalid. |
| 400 | DryRunOperation | Request validation has been passed with DryRun flag set. | The request performs the pre-check operation and has passed the pre-check, and does not create an instance. |
| 400 | ResourceGroupNotExist | The Specified ResourceGroupId does not exist. | |
| 403 | RealNameAuthenticationError | Your account has not passed the real-name authentication yet. | |
| 403 | AuthorizationFailure | The request processing has failed due to authorization failure. | |
| 403 | TokenServiceError | The specified token is duplicated, please change it. | |
| 404 | InvalidCapacity.NotFound | The Capacity provided does not exist in our records. | The specified storage specification does not exist. |
| 404 | InvalidvSwitchId | The Specified vSwitchId zone not supported. | |
| 404 | InvalidVpcIdOrVswitchId.NotSupported | The Specified vpcId or vSwitchId not supported. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.