Create a Redis (open-source) instance with a classic or cloud-native architecture, or a Tair memory-optimized instance with a classic architecture. To create a Tair instance with a cloud-native architecture, use the CreateTairInstance API.
Operation description
Before you call this API, make sure you understand the billing methods and pricing of ApsaraDB for Tair.
This API is used to create a Redis Community Edition instance or a Tair Memory Type (Classic) instance. To create a Tair Cloud-native Edition instance, call the CreateTairInstance API.
For instructions on how to perform this operation in the console and for guidance on instance selection, 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 ID of the region in which to create the instance. Call the DescribeRegions operation to get a list of region IDs. |
cn-hangzhou |
| Token |
string |
No |
A client-generated token to ensure the idempotence of the request. The token must be unique across requests, case-sensitive, and cannot exceed 64 ASCII characters. |
ETnLKlblzczshOTUbOCz**** |
| InstanceName |
string |
No |
The name of the instance. The name must be 2 to 80 characters long, start with a letter (uppercase or lowercase) or a Chinese character, and not contain spaces or the characters |
apitest |
| Password |
string |
No |
The password for the instance. The password must be 8 to 32 characters long and contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. The allowed special characters are |
Pass!123456 |
| Capacity |
integer |
No |
The storage capacity of the instance, in MB. Note
You must specify either the Capacity or the InstanceClass parameter. |
16384 |
| InstanceClass |
string |
No |
The instance type. For example, Note
You must specify either the Capacity or the InstanceClass parameter. |
redis.master.small.default |
| ZoneId |
string |
No |
The ID of the primary zone for the instance. You can call the DescribeZones operation to query available zones. Note
You can also specify a secondary zone by using the |
cn-hangzhou-h |
| SecondaryZoneId |
string |
No |
The ID of the secondary zone. You can call the DescribeZones operation to query the latest list of zones. Note
The value of this parameter cannot be the same as the value of the |
cn-hangzhou-g |
| ChargeType |
string |
No |
The billing method. Valid values:
|
PostPaid |
| NodeType |
string |
No |
The node type. Valid values:
Note
Set this parameter to MASTER_SLAVE or STAND_ALONE for cloud native edition instances. Set this parameter to double or single for classic edition instances. |
STAND_ALONE |
| NetworkType |
string |
No |
The network type. Valid value:
|
VPC |
| VpcId |
string |
No |
The ID of the VPC. |
vpc-bp1nme44gek34slfc**** |
| VSwitchId |
string |
No |
The ID of the vSwitch. |
vsw-bp1e7clcw529l773d**** |
| Period |
string |
No |
The subscription duration, in months. Valid values: 1 to 9, 12, 24, 36, and 60. Note
This parameter is available and required only when ChargeType is set to PrePaid. |
12 |
| BusinessInfo |
string |
No |
The campaign ID or business information. |
000000000 |
| CouponNo |
string |
No |
The coupon code. Default value: |
youhuiquan_promotion_option_id_for_blank |
| SrcDBInstanceId |
string |
No |
To create an instance from a backup, specify the ID of the source instance. Note
This parameter must be used in conjunction with one of the following parameters: BackupId, ClusterBackupId (recommended for cloud native, cluster-architecture instances), or RestoreTime. |
r-bp1zxszhcgatnx**** |
| BackupId |
string |
No |
The ID of the backup that you want to use to create the new instance. You can obtain backup IDs by calling the DescribeBackups operation. If the source instance has a cluster architecture, you must specify the backup IDs of all its shards, separated by commas (for example, "10**,11**,15**"). Note
If your source instance is a cloud native cluster instance, it is recommended to call DescribeClusterBackupList to get a cluster backup ID (for example, "cb-xx") and use the |
111111111 |
| InstanceType |
string |
No |
The instance type. Valid values:
|
Redis |
| EngineVersion |
string |
No |
The Redis engine version. Valid values for classic edition instances:
Valid values for cloud native edition instances:
Note
The default value is 5.0. Valid values:
|
5.0 |
| PrivateIpAddress |
string |
No |
The private IP address of the new instance. Note
The IP address must be within the CIDR block of the specified vSwitch. |
172.16.0.*** |
| AutoUseCoupon |
string |
No |
Specifies whether to use a coupon. Valid values:
|
false |
| AutoRenew |
string |
No |
Specifies whether to enable auto-renewal for the instance. Valid values:
|
true |
| AutoRenewPeriod |
string |
No |
The auto-renewal duration, in months. Valid values: 1, 2, 3, 6, and 12. Note
This parameter is required when AutoRenew is set to true. |
3 |
| ResourceGroupId |
string |
No |
The ID of the resource group. |
rg-resourcegroupid1 |
| RestoreTime |
string |
No |
The point in time to which you want to restore data, specified in the yyyy-MM-ddTHH:mm:ssZ (UTC) format. |
2019-06-19T16:00:00Z |
| DedicatedHostGroupId |
string |
No |
The ID of the dedicated host group. This parameter is required when you create a Redis instance in a dedicated host group. |
dhg-uv4fnk6r7zff**** |
| ShardCount |
integer |
No |
The number of shards. This parameter is available only for cloud native edition instances.
|
4 |
| ReplicaCount |
integer |
No |
The number of replicas in the primary zone. This parameter is available only for multi-replica cluster instances of the cloud native edition. You can specify a value from 1 to 4. Note
When creating a multi-zone instance, you can use this parameter and |
2 |
| SlaveReplicaCount |
integer |
No |
The number of replicas in the secondary zone. |
2 |
| ReadOnlyCount |
integer |
No |
The number of read-only replicas in the primary zone. This parameter is available only when creating a read/write splitting instance of the cloud native edition.
Note
If you create a multi-zone instance, you can use this parameter and
|
2 |
| SlaveReadOnlyCount |
integer |
No |
The number of read-only replicas in the secondary zone. |
2 |
| GlobalInstanceId |
string |
No |
The ID of the distributed instance. This parameter is available only in Chinese mainland. This parameter is required to add the new instance as a child of a distributed instance. For more information and the console procedure, see Add a child instance to a distributed instance. |
gr-bp14rkqrhac**** |
| GlobalInstance |
boolean |
No |
Specifies whether to create the new instance as the first child instance of a distributed instance. Valid values:
Note
|
false |
| Port |
string |
No |
The service port of the instance. The port number must be between 1 and 65535. The default value is 6379. |
6379 |
| DryRun |
boolean |
No |
Specifies whether to perform a dry run. Valid values:
|
false |
| GlobalSecurityGroupIds |
string |
No |
The IDs of the security groups to associate with the instance. You can specify multiple security group IDs, separated by commas (,). IDs cannot be repeated. Important This parameter is available only for cloud native edition instances. Security groups are not supported for classic edition instances. |
g-zsldxfiwjmti0kcm**** |
| Appendonly |
string |
No |
Specifies whether to enable AOF persistence for the new instance. Valid values:
Note
This parameter is available only for classic edition instances. AOF persistence cannot be configured for cloud native edition instances at creation. Valid values:
|
yes |
| ConnectionStringPrefix |
string |
No |
The prefix of the connection string. The prefix must be 8 to 40 characters long, start with a lowercase letter, and contain only lowercase letters and digits. Note
The full connection string is in the format: <prefix>.redis.rds.aliyuncs.com. |
r-bp1zxszhcgatnx**** |
| ParamGroupId |
string |
No |
The ID of the parameter group. This ID must be globally unique. Important This parameter is available only for cloud native edition instances. |
rpg-test** |
| Tag |
array<object> |
No |
The tags of the instance. |
|
|
object |
No |
Object. |
||
| Key |
string |
No |
The key of the tag. Note
|
testkey |
| Value |
string |
No |
The value for tag Note
The N in Tag.N.Value specifies the sequence 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. |
testvalue |
| ClusterBackupId |
string |
No |
The ID of the cluster backup. You can get this ID by calling the DescribeClusterBackupList operation. This parameter is available for some cloud native cluster instances.
|
cb-hyxdof5x9kqb**** |
| RecoverConfigMode |
string |
No |
Specifies which configurations to restore from the backup when creating an instance. Valid values include By default, this parameter is empty, which means no configurations are restored. Note
This parameter is applicable only to cloud native edition instances. The source backup must contain the specified configurations. You can call the DescribeBackups operation and check the |
whitelist,config,account |
| InstanceEndpointType |
string |
No |
The connection endpoint type. This parameter is applicable only when you create a dual-zone, read/write splitting instance of the cloud native edition. If this parameter is not specified,
Important This parameter is applicable only to dual-zone, read/write splitting instances of the cloud native edition. For other instance types, only zone-independent endpoints are supported, and specifying UnifiedEndpoint has no effect.Important The UnifiedEndpoint parameter is currently available only to allowlisted users. API calls will fail if you are not on the allowlist. To be added to the allowlist, submit a ticket. |
AzIndependentEndpoint |
| MaintainStartTime |
string |
No |
The start of the maintenance window. Specify the time in the HH:mmZ format (UTC). For example, to set the start time to 01:00 (UTC+8), specify Note
If this parameter is not specified, the maintenance window starts at 02:00 (UTC+8), which is 18:00 (UTC). |
03:00Z |
| MaintainEndTime |
string |
No |
The end time of the maintenance window. Specify the time in the HH:mmZ format (UTC). For example, to set the end time to 02:00 (UTC+8), specify Note
The duration of the maintenance window must be at least one hour. Note
If this parameter is not specified, the maintenance window ends at 06:00 (UTC+8), which is 22:00 (UTC). |
07:00Z |
The following example shows a request that creates a Redis 7.0 instance with a cluster architecture.
{
"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 response object. |
||
| VpcId |
string |
The ID of the VPC. |
vpc-bp1nme44gek34slfc**** |
| QPS |
integer |
The theoretical queries per second (QPS) of the instance. |
100000 |
| Capacity |
integer |
The storage capacity of the instance, in MB. |
16384 |
| ConnectionDomain |
string |
The private connection endpoint of the instance. |
r-bp1zxszhcgatnx****.redis.rds.aliyuncs.com |
| ChargeType |
string |
The billing method. Valid values:
|
PostPaid |
| NetworkType |
string |
The network type. Valid values:
|
VPC |
| InstanceId |
string |
The ID of the instance. |
r-bp1zxszhcgatnx**** |
| Port |
integer |
The connection port of the instance. |
6379 |
| Config |
string |
The 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} |
| RegionId |
string |
The ID of the region. |
cn-hongkong |
| EndTime |
string |
The expiration time of the subscription instance. The time is displayed in UTC. Format: yyyy-MM-ddTHH:mm:ssZ. |
2019-01-18T16:00:00Z |
| VSwitchId |
string |
The ID of the vSwitch. |
vsw-bp1e7clcw529l773d**** |
| RequestId |
string |
The ID of the request. |
5DEA3CC9-F81D-4387-8E97-CEA40F09**** |
| NodeType |
string |
The node type. Valid values:
|
MASTER_SLAVE |
| Connections |
integer |
The maximum number of connections. |
10000 |
| Bandwidth |
integer |
The bandwidth of the instance. Unit: MB/s. |
32 |
| InstanceName |
string |
The name of the instance. |
apitest |
| ZoneId |
string |
The ID of the zone. |
cn-hangzhou-b |
| InstanceStatus |
string |
The state of the instance. For this operation, the returned value is always |
Creating |
| PrivateIpAddr |
string |
The private IP address of the instance. |
172.16.0.10 |
| UserName |
string |
The username of the account. By default, the username is the same as the instance ID. |
r-bp1zxszhcgatnx**** |
| OrderId |
integer |
The ID of the order. |
2084452111111 |
Examples
Success response
JSON format
{
"VpcId": "vpc-bp1nme44gek34slfc****",
"QPS": 100000,
"Capacity": 16384,
"ConnectionDomain": "r-bp1zxszhcgatnx****.redis.rds.aliyuncs.com",
"ChargeType": "PostPaid",
"NetworkType": "VPC",
"InstanceId": "r-bp1zxszhcgatnx****",
"Port": 6379,
"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}",
"RegionId": "cn-hongkong",
"EndTime": "2019-01-18T16:00:00Z",
"VSwitchId": "vsw-bp1e7clcw529l773d****",
"RequestId": "5DEA3CC9-F81D-4387-8E97-CEA40F09****",
"NodeType": "MASTER_SLAVE",
"Connections": 10000,
"Bandwidth": 32,
"InstanceName": "apitest",
"ZoneId": "cn-hangzhou-b",
"InstanceStatus": "Creating",
"PrivateIpAddr": "172.16.0.10",
"UserName": "r-bp1zxszhcgatnx****",
"OrderId": 2084452111111
}
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.