CreateInstance
Creates a Redis Community Edition instance with the classic or cloud-native architecture, or a Tair in-memory instance with the classic architecture. To create a Tair instance with the cloud-native architecture, call the CreateTairInstance operation.
Operation description
Make sure that you fully understand the billing methods and pricing of ApsaraDB for Redis (Tair) before you call this operation.
This operation allows you to create a Redis Community Edition instance or a Tair memory-optimized instance with the classic architecture. To create a Tair instance with the cloud-native architecture, call the CreateTairInstance operation.
For information about how to create a Redis instance and select instance types in the console, 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 must 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 must 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 specifies a 1 GB Community Edition (classic architecture) instance with the standard architecture and two replicas. 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 ID of the primary zone. You can call the DescribeRegions operation to query the most recent zone list, and use this parameter to specify the zone where you want to create the instance. Note
You can also specify the SecondaryZoneId parameter to configure a secondary zone. The deployment of the primary and secondary nodes in the specified primary and secondary zones implements a dual-zone primary/secondary architecture. For example, you can set the ZoneId parameter to cn-hangzhou-h and the SecondaryZoneId parameter to cn-hangzhou-g. |
cn-hangzhou-h |
| SecondaryZoneId |
string |
No |
The ID of the secondary zone. 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. You cannot specify the ID of a multi-zone deployment. |
cn-hangzhou-g |
| ChargeType |
string |
No |
The billing method. Valid values:
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. Valid values:
|
STAND_ALONE |
| NetworkType |
string |
No |
The network type. Valid values:
Valid values:
|
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 period. Unit: months. Valid values: 1 to 9, 12, 24, 36, and 60. Note
This parameter is required and takes effect only when the ChargeType parameter is set to PrePaid. |
12 |
| BusinessInfo |
string |
No |
The ID of the promotional event or business information. |
000000000 |
| CouponNo |
string |
No |
The coupon code. Default value: |
youhuiquan_promotion_option_id_for_blank |
| SrcDBInstanceId |
string |
No |
The source instance ID. Specify this parameter if you want to create an instance based on the backup set of an existing instance. 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 together 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 specified backup set to create the instance. You can call 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 instance and a cluster instance, we recommend that you call 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:
Valid values:
|
Redis |
| EngineVersion |
string |
No |
The engine version. For Redis classic architecture, valid values are:
For Redis cloud-native architecture, valid values are:
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 fall within the vSwitch CIDR block 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:
Valid values:
|
true |
| AutoRenewPeriod |
string |
No |
The auto-renewal period. Unit: months. Valid values: 1, 2, 3, 6, and 12. Note
This parameter is required when the AutoRenew parameter 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 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. 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 ID of the dedicated cluster. 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 specify a custom number of shards.
|
4 |
| ReplicaCount |
integer |
No |
The number of secondary nodes in the primary zone. This parameter applies only to cloud-native cluster instances with multiple replicas. You can use this parameter to specify a custom 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 specify 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 specify 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. This parameter is required and is active only when you want to append the new instance as a child instance to a distributed instance. For more information and console operations, see Add a child instance to a distributed instance. |
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 by setting this parameter. 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 on the request. Valid values:
|
false |
| GlobalSecurityGroupIds |
string |
No |
The global IP address whitelist templates for 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 AOF parameter settings for 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 ID of the parameter template. The ID must be globally unique. Important This parameter applies only to cloud-native instances. |
rpg-test** |
| Tag |
array<object> |
No |
The tags of the instance. |
|
|
object |
No |
The tag. |
||
| Key |
string |
No |
The key of the tag. Note
|
testkey |
| Value |
string |
No |
The value of the tag. Note
N specifies the sequence number of the tag value. 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 set. Some new cluster architectures support cluster backup set IDs. 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 Default value: empty. An empty value 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 the original backup set must contain the account, kernel parameters, and whitelist information. 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-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-zone read/write splitting instances. For other instance types, 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. Valid values:
|
AzIndependentEndpoint |
| MaintainStartTime |
string |
No |
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, to set the start time to 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 |
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, to set the end time to 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 architecture 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 response object. |
||
| VpcId |
string |
The ID of the virtual private cloud (VPC). |
vpc-bp1nme44gek34slfc**** |
| QPS |
integer |
The queries per second (QPS). This is the theoretical value for the current instance type. |
100000 |
| Capacity |
integer |
The storage capacity of the instance. Unit: MB. |
16384 |
| ConnectionDomain |
string |
The internal network endpoint of the Redis 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 |
Instance ID of the instance. Instance ID is globally unique. |
r-bp1zxszhcgatnx**** |
| Port |
integer |
The Redis service port. |
6379 |
| 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} |
| RegionId |
string |
The region where the instance is deployed. |
cn-hongkong |
| EndTime |
string |
The time when the subscription instance expires. The time is in the yyyy-MM-ddTHH:mm:ssZ format. The time is in UTC. |
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 to the instance. |
10000 |
| Bandwidth |
integer |
The bandwidth limit of the instance. Unit: MB/s. |
32 |
| InstanceName |
string |
The name of the instance. |
apitest |
| ZoneId |
string |
The ID of the zone to which the instance belongs. |
cn-hangzhou-b |
| InstanceStatus |
string |
The current status of the instance. The value is fixed to Creating. |
Creating |
| PrivateIpAddr |
string |
The internal IP address of the instance. |
172.16.0.10 |
| UserName |
string |
The username used to connect to the Redis instance. By default, an account named after the instance ID is included. |
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.