All Products
Search
Document Center

Tair (Redis® OSS-Compatible):CreateInstance

最終更新日:Oct 30, 2024

Creates an ApsaraDB for Redis instance.

Operation description

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 an ApsaraDB for Redis instance or a classic Tair DRAM-based instance. To create a cloud-native Tair instance, call the CreateTairInstance operation.

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

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
kvstore:CreateInstancecreate
  • DBInstance
    acs:kvstore:{#regionId}:{#accountId}:instance/*
  • kvstore:InstanceClass
  • kvstore:Appendonly
  • kvstore:InstanceType
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

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.

cn-hangzhou
TokenstringNo

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 the token is unique among different requests. The token is case-sensitive. The token can contain only ASCII characters and cannot exceed 64 characters in length.

ETnLKlblzczshOTUbOCz****
InstanceNamestringNo

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 @ / : = " < > { [ ] }

apitest
PasswordstringNo

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 specific special characters. These special characters include ! @ # $ % ^ & * ( ) _ + - =

Pass!123456
CapacitylongNo

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
InstanceClassstringNo

The instance type. For example, redis.master.small.default indicates a Community Edition standard master-replica instance that has 1 GB of memory. For more information, see Overview .

**

Description You must specify at least one of the Capacity and InstanceClass parameters when you call the CreateInstance operation.

redis.master.small.default
ZoneIdstringYes

The primary zone ID of the instance. You can call the DescribeRegions operation to query the most recent zone list.

cn-hangzhou-e
ChargeTypestringNo

The billing method of the instance. Default value: PrePaid. Valid values:

  • PrePaid: subscription
  • PostPaid: pay-as-you-go
PostPaid
NodeTypestringNo

The node type. Valid values:

  • MASTER_SLAVE: high availability (master-replica)
  • STAND_ALONE: standalone
  • double: master-replica
  • single: standalone
Note To create a cloud-native instance, set this parameter to MASTER_SLAVE or STAND_ALONE. To create a classic instance, set this parameter to double or single.
STAND_ALONE
NetworkTypestringNo

The network type of the instance. Default value: VPC. Valid values:

  • VPC
VPC
VpcIdstringNo

The ID of the virtual private cloud (VPC).

vpc-bp1nme44gek34slfc****
VSwitchIdstringNo

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

vsw-bp1e7clcw529l773d****
PeriodstringNo

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 available and required only if the ChargeType parameter is set to PrePaid.
12
BusinessInfostringNo

The ID of the promotional event or business information.

000000000
CouponNostringNo

The coupon code. Default value: default.

youhuiquan_promotion_option_id_for_blank
SrcDBInstanceIdstringNo

If you want to create an instance based on the backup set of an existing instance, set this parameter to the ID of the source instance.

Note After you specify the SrcDBInstanceId parameter, use the BackupId, ClusterBackupId (recommended for cloud-native cluster instances), or RestoreTime parameter to specify the backup set or the specific point in time that you want to use to create an instance. The SrcDBInstanceId parameter must be used in combination with one of the preceding three parameters.
r-bp1zxszhcgatnx****
BackupIdstringNo

If your instance is a cloud-native cluster instance, we recommend that you use DescribeClusterBackupList to query the backup set ID of the cluster instance, such as cb-xx. Then, set the ClusterBackupId request parameter to the backup set ID to clone the cluster instance. This eliminates the need to specify the backup set ID of each shard.

You can set the BackupId parameter to the backup set ID of the source instance. The system uses the data stored in the backup set to create an instance. You can call the DescribeBackups operation to query backup set IDs. If the source instance is a cluster instance, set the BackupId parameter to the backup set IDs of all shards of the source instance, separated by commas (,). Example: "10**,11**,15**".

111111111
InstanceTypestringNo

The category of the instance. Default value: Redis. Valid values:

  • Redis
  • Memcache
Redis
EngineVersionstringNo

The engine version. Valid values for classic instances:

  • 2.8 (not recommended due to scheduled EOFS)
  • 4.0 (not recommended)
  • 5.0

Valid values for cloud-native instances:

  • 5.0
  • 6.0 (recommended)
  • 7.0
Note The default value is 5.0.
4.0
PrivateIpAddressstringNo

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.
172.16.0.***
AutoUseCouponstringNo

Specifies whether to use a coupon. Default value: false. Valid values:

  • true: uses a coupon.
  • false: does not use a coupon.
false
AutoRenewstringNo

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

  • true: enables auto-renewal.
  • false: disables auto-renewal.
true
AutoRenewPeriodstringNo

The subscription duration that is supported by auto-renewal. Unit: months. Valid values: 1, 2, 3, 6, and 12.

Note This parameter is required only if the AutoRenew parameter is set to true.
3
ResourceGroupIdstringNo

The ID of the resource group.

rg-resourcegroupid1
RestoreTimestringNo

If data flashback is enabled for the source instance, you can use this parameter to 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 point in time to create an instance. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

2019-06-19T16:00:00Z
DedicatedHostGroupIdstringNo

The ID of the dedicated cluster. This parameter is required if you create an instance in a dedicated cluster.

dhg-uv4fnk6r7zff****
ShardCountintegerNo

The number of data shards. This parameter is available only if you create a cluster instance that uses cloud disks.

4
ReadOnlyCountintegerNo

The number of read replicas in the primary zone. This parameter applies only to read/write splitting instances that use cloud disks. You can use this parameter to customize the number of read replicas. Valid values: 1 to 9.

Note The sum of the values of this parameter and SlaveReadOnlyCount cannot be greater than 9.
5
GlobalInstanceIdstringNo

The ID of the distributed instance. This parameter is available only on the China site (aliyun.com).

gr-bp14rkqrhac****
GlobalInstancebooleanNo

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.

  • If you want to create an ApsaraDB for Redis Enhanced Edition (Tair) DRAM-based instance that runs Redis 5.0, you must set this parameter to true.

  • This parameter is available only on the China site (aliyun.com).

false
SecondaryZoneIdstringNo

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.
cn-hangzhou-h
PortstringNo

The port number that is used to connect to the instance. Valid values: 1024 to 65535. Default value: 6379.

6379
DryRunbooleanNo

Specifies whether to perform a dry run. Default value: false. Valid values:

  • true: performs a dry run and does not create the instance. The system prechecks the request parameters, request format, service limits, and available resources. If the request fails the dry run, an error message is returned. If the request passes the dry run, the DryRunOperation error code is returned.
  • false: performs a dry run and sends the request. If the request passes the dry run, the instance is created.
false
GlobalSecurityGroupIdsstringNo

The global IP whitelist template for the instance. Multiple IP whitelist templates should be separated by English commas (,) and cannot be duplicated.

g-zsldxfiwjmti0kcm****
AppendonlystringNo

Specifies whether to enable append-only file (AOF) persistence for the instance. Valid values:

  • yes (default): enables AOF persistence.
  • no: disables AOF persistence.

**

Description This parameter is applicable to classic instances, and is unavailable for cloud-native instances.

yes
ConnectionStringPrefixstringNo

The operation that you want to perform. Set the value to AllocateInstancePublicConnection.

r-bp1zxszhcgatnx****
ParamGroupIdstringNo

The parameter template ID, which must be globally unique.

rpg-test**
Tagarray<object>No

The tags of the instance.

objectNo

The object.

KeystringNo

The keys of the tags that are added to the instance.

Note
  • N specifies the serial number of the tag. Up to 20 tags can be added to a single instance. 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.

testkey
ValuestringNo

The values of the tags that are added to 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.
testvalue
ClusterBackupIdstringNo

This parameter is supported for specific new cluster instances. You can query the backup set ID by using the DescribeClusterBackupList operation.

  • If this parameter is supported, you can specify the backup set ID. In this case, you do not need to specify the BackupId parameter.
  • If this parameter is not supported, set the BackupId parameter to the IDs of backup sets for all shards of the source instance, separated by commas (,). Example: "2158****20,2158****22".
cb-hyxdof5x9kqbtust
SlaveReadOnlyCountintegerNo

The number of read replicas in the secondary zone. This parameter is used to create a read/write splitting instance that is deployed across multiple zones. The sum of the values of this parameter and ReadOnlyCount cannot be greater than 9.

Note When you create a multi-zone read/write splitting instance, you must specify both SlaveReadOnlyCount and SecondaryZoneId.
2

Response parameters

ParameterTypeDescriptionExample
object

The object.

VpcIdstring

The ID of the VPC.

vpc-bp1nme44gek34slfc****
QPSlong

The expected maximum queries per second (QPS).

100000
Capacitylong

The storage capacity of the instance. Unit: MB.

16384
ConnectionDomainstring

The internal endpoint of the instance.

r-bp1zxszhcgatnx****.redis.rds.aliyuncs.com
ChargeTypestring

The billing method of the instance. Valid values:

  • PrePaid: subscription
  • PostPaid: pay-as-you-go
PostPaid
NetworkTypestring

The network type of the instance. Valid values:

  • CLASSIC: classic network
  • VPC: VPC
VPC
InstanceIdstring

The GUID of the instance.

r-bp1zxszhcgatnx****
Portinteger

The port number that is used to connect to the instance.

6379
Configstring

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}
RegionIdstring

The region ID of the instance.

cn-hongkong
EndTimestring

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.

2019-01-18T16:00:00Z
VSwitchIdstring

The ID of the vSwitch to which the instance is connected.

vsw-bp1e7clcw529l773d****
RequestIdstring

The ID of the request.

5DEA3CC9-F81D-4387-8E97-CEA40F09****
NodeTypestring

The node type. Valid values:

  • STAND_ALONE: standalone
  • MASTER_SLAVE: master-replica
MASTER_SLAVE
Connectionslong

The maximum number of connections supported by the instance.

10000
Bandwidthlong

The maximum bandwidth of the instance. Unit: MB/s.

32
InstanceNamestring

The name of the instance.

apitest
ZoneIdstring

The zone ID of the instance.

cn-hangzhou-b
InstanceStatusstring

The state of the instance. The return value is Creating.

Creating
PrivateIpAddrstring

The private IP address of the instance.

172.16.0.10
UserNamestring

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.

r-bp1zxszhcgatnx****
OrderIdlong

The ID of the order.

2084452111111

Examples

Sample success responses

JSONformat

{
  "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 codeError codeError messageDescription
400ZoneIdNotFoundSpecify iz not support switch network.Unable to find Availability Zone
400InvalidShardInfo.FormatShard total number is out of range.-
400InvalidInstancelevelSpecified Instance level dose not match gdc other member instance level.-
400InvalidBackupLogStatusBackup logs are not enabled for the specified source instance.-
400InvalidStatusSpecified instance status is Modifying.Specified instance status is Modifying.
400SecurityRisk.AuthVerificationwe 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.-
400MissingParameterPeriod is mandatory for this action.-
400InvalidToken.MalformedThe Specified parameter Token is not valid.-
400InvalidInstanceName.MalformedThe Specified parameter InstanceName is not valid.-
400InvalidPassword.MalformedThe Specified parameter Password is not valid.-
400InsufficientBalanceYour account does not have enough balance.Your account balance is insufficient. Add funds to your account and try again.
400QuotaExceed.AfterpayInstanceLiving afterpay instances quota exceeded.The maximum number of instances has been reached.
400InvalidCapacity.NotFoundThe Capacity provided does not exist in our records.The specified storage specification does not exist
400ResourceNotAvailableResource you requested is not available for finance user.The requested resource is unavailable to users of Alibaba Finance Cloud.
400PaymentMethodNotFoundNo payment method has been registered on the account.No payment methods are specified for your account.
400IdempotentParameterMismatchRequest uses a client token in a previous request but is not identical to that request.The current request uses a token that was already used in a different request.
400QuotaNotEnoughQuota not enough in this zone.The number of instances specified for this region is insufficient.
400QuotaExceedLiving afterpay instances quota exceed.The maximum number of instances has been reached.
400VpcServiceErrorInvoke vpc service failed.-
400IzNotSupportVpcErrorSpecify iz not support vpc.The specified iz does not support VPCs.
400InvalidvSwitchIdThe vpc does not cover the vswitch.-
400InvalidIzNo.NotSupportedThe Specified vpc zone not supported.-
400InvalidAccountPassword.FormatSpecified account password is not valid.-
400InstanceClass.NotMatchCurrent instance class and instance type is not match.-
400InvalidVPCId.NotFoundSpecified virtual vpc is not found.The specified VPC is not found. Check whether the VPC ID is correct.
400AccountMoneyValidateErrorAccount money validate error.-
400RequestTokenConflictSpecified request token conflict.-
400InvalidIPNotInSubnetError ip not in subnet.-
400InvalidEngineVersion.MalformedSpecified engine version is not valid.The error message returned because the instance engine version is invalid.
400Zone.ClosedThe specified zone is closed.-
400VSwithNotBelongToNotVpcFaultThe vSwitch does not belong to current vpc.-
400PayIllegalAgreementPay mayi with holding agreement illegal.-
400IllegalParamErrorvalidateSaleConditionWithSubArticle failed.-
400CASH_BOOK_INSUFFICIENTNo payment method is specified for your account. We recommend that you add a payment method or maitain a minimum prepayment balance of INR 1000.-
400InvalidRegion.FormatSpecified Region is not valid.The specified region is invalid.
400DryRunOperationRequest 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.
400ResourceGroupNotExistThe Specified ResourceGroupId does not exist.-
403RealNameAuthenticationErrorYour account has not passed the real-name authentication yet.Your account has not completed real-name verification.
403AuthorizationFailureThe request processing has failed due to authorization failure.-
403TokenServiceErrorThe specified token is duplicated, please change it.-
404InvalidvSwitchIdThe Specified vSwitchId zone not supported.-
404InvalidVpcIdOrVswitchId.NotSupportedThe Specified vpcId or vSwitchId not supported.-

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-10-09The Error code has changed. The request parameters of the API has changedView Change Details
2024-05-23The Error code has changed. The request parameters of the API has changedView Change Details
2024-05-10The Error code has changed. The request parameters of the API has changedView Change Details
2024-01-12The Error code has changedView Change Details
2023-09-05The Error code has changedView Change Details
2023-08-28The Error code has changed. The request parameters of the API has changedView Change Details
2023-08-24The Error code has changed. The request parameters of the API has changedView Change Details
2023-06-26The Error code has changed. The request parameters of the API has changedView Change Details
2023-04-23The Error code has changed. The request parameters of the API has changedView Change Details
2023-04-03The Error code has changed. The request parameters of the API has changedView Change Details
2022-06-15The Error code has changed. The response structure of the API has changedView Change Details
2022-03-01The Error code has changedView Change Details
2022-03-01The Error code has changed. The request parameters of the API has changedView Change Details
2022-02-22The Error code has changedView Change Details