All Products
Search
Document Center

Tair (Redis® OSS-Compatible):CreateInstances

Last Updated:Oct 30, 2024

Creates multiple ApsaraDB for Redis instances at a time.

Operation description

Before you call this operation, make sure that you understand the billing methods and pricing of ApsaraDB for Redis.

Note You can call this operation to create an ApsaraDB for Redis classic instance or a Tair DRAM-based classic instance. We recommend that you use an API operation for creating a single instance:
  • CreateInstance : creates an ApsaraDB for Redis instance or a Tair DRAM-based classic instance.

  • CreateTairInstance : creates a Tair cloud-native instance. The instance can be a DRAM-based, persistent memory-optimized, or ESSD/SSD-based 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:CreateInstancescreate
  • DBInstance
    acs:kvstore:{#regionId}:{#accountId}:instance/*
  • kvstore:InstanceClass
  • kvstore:InstanceType
  • kvstore:Appendonly
none

Request parameters

ParameterTypeRequiredDescriptionExample
InstancesstringYes

The JSON-formatted configurations of the instance. For more information, see the "Description of the Instances parameter" section of this topic.

[{ "RegionId": "cn-hangzhou", "izNo": "cn-hangzhou-b", "quantity": 2, "instanceType": "Redis", "instanceClass": "redis.master.small.default", "EngineVersion": "5.0", "ChargeType": "PostPaid"}]
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 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.

ETnLKlblzczshOTUbOCz****
AutoPaybooleanNo

Specifies whether to enable automatic payment. Valid values:

  • true (default).
  • false. If automatic payment is disabled, you must perform the following steps to complete the payment in the ApsaraDB for Redis console: In the top navigation bar, choose Expenses > Renewal Management. In the left-side navigation pane, click Orders. On the Orders page, find the order and complete the payment.
Note This parameter is valid only if the value of the ChargeType field in the Instances parameter is set to PrePaid.
true
BusinessInfostringNo

The additional business information about the instance.

000000000
CouponNostringNo

The coupon code. Default value: youhuiquan_promotion_option_id_for_blank.

youhuiquan_promotion_option_id_for_blank
EngineVersionstringNo

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

Note The default value is 5.0.

Valid values:

  • 2.8
  • 4.0
  • 5.0
5.0
RebuildInstancebooleanNo

Specifies whether to restore the source instance from the recycle bin. Valid values:

  • true
  • false (default)
Note This parameter is valid only if the SrcDBInstanceId field in the Instances parameter is specified.
false
AutoRenewstringNo

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

  • true: yes
  • false: no
Note This parameter is available only if ChargeType in the Instances parameter is set to PrePaid.
false
ResourceGroupIdstringNo

The ID of the resource group to which to assign the instance.

rg-resourcegroupid1

Additional description of the Instances parameter

ParameterTypeRequiredExampleDescription
RegionIdStringYescn-hangzhouThe region ID. You can call the DescribeRegions operation to query the most recent region list.
IzNoStringYescn-hangzhou-bThe primary zone ID. You can call the DescribeRegions operation to query the most recent zone list.
QuantityIntegerNo1The number of instances that you want to create. Valid values: 1 to 300. Default value: 1.
InstanceTypeStringNoRedisThe database engine of the instance. Valid values:
  • Redis (default)
  • Memcache
InstanceClassStringNoredis.master.small.defaultThe 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 .Note You must specify this parameter or Capacity.
CapacityLongNo16384The storage capacity of the instance. Unit: MB. For more information, see Overview .Note You must specify this parameter or InstanceClass.
EngineVersionStringNo5.0The major version of the instance. Valid values:
  • 5.0 (default)
  • 4.0
ChargeTypeStringNoPrePaidThe billing method of the instance. Valid values:
  • PrePaid: subscription.
  • PostPaid (default): pay-as-you-go.
PeriodLongNo12The subscription duration. Valid values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 24,36, and 60. Unit: months.Note This parameter is valid and required only if you set ChargeType to PrePaid.
AutoRenewStringNotrueSpecifies whether to enable auto-renewal for the instance. Valid values:
  • true
  • false (default)
Note This parameter is valid only if you set ChargeType to PrePaid.
InstanceNameStringNoapitestThe name of the instance.
  • The name must start with a letter and must be 2 to 80 characters in length.
  • The name cannot contain spaces or the following special characters: @ / : = " < > { [ ] }
PasswordStringNoPass!123456The password that is used to connect to the instance.
  • The password must be 8 to 32 characters in length.
  • The password must contain at least three of the following character types: uppercase letters, lowercase letters, specific special characters, and digits.
  • These special characters include ! @ # $ % ^ & * ( ) _ + - =
NetworkTypeStringNoVPCThe network type of the instance. Set the value to VPC, which is the default value.
VpcIdStringNovpc-bp1nme44gek34slfc****The ID of the virtual private cloud (VPC). You can call the DescribeVpcs operation to query VPC IDs.
VSwitchIdStringNovsw-bp1e7clcw529l773d****The ID of the vSwitch that belongs to the VPC. You can call the DescribeVpcs operation to query vSwitch IDs.
NodeTypeStringNoMASTER_SLAVEThe type of the node. Valid values:
  • STAND_ALONE: standalone.
  • MASTER_SLAVE (default): high availability (master-replica).
SrcDBInstanceIdStringNor-bp1zxszhcgatnx****The ID of the source instance. You can call the DescribeInstances operation to query instance IDs.Note This parameter is required only if you want to create an instance from the backup set of a specified instance.
BackupIdStringNo111111111The ID of the backup set. You can call the DescribeBackups operation to query the backup set IDs.Note If you want to create an instance from the backup set of a specified instance, you must specify the source instance in SrcDBInstanceId. You must also specify the ID of the backup set that was created based on the source instance. Then, the system creates an instance based on the specified back set.
RebuildInstanceStringNofalseSpecifies whether to restore the source instance from the recycle bin. Valid values:
  • true
  • false (default)
Note If you specify this parameter, you must also specify SrcDBInstanceId.

Sample request with the Instances parameter configured

[{
    "RegionId": "cn-hangzhou",
    "izNo": "cn-hangzhou-b",
    "quantity": 1,
    "instanceType": "Redis",
    "instanceClass": "redis.logic.sharding.1g.2db.0rodb.4proxy.default",
    "EngineVersion": "5.0",
    "ChargeType": "PrePaid",
	"Period":"1"
}]

Response parameters

ParameterTypeDescriptionExample
object
OrderIdstring

The ID of the order.

20905403119****
RequestIdstring

The ID of the request.

561AFBF1-BE20-44DB-9BD1-6988B53E****
InstanceIdsarray

The IDs of instances that were created.

InstanceIdstring
r-bp16e70a4338****

Examples

Sample success responses

JSONformat

{
  "OrderId": "20905403119****",
  "RequestId": "561AFBF1-BE20-44DB-9BD1-6988B53E****",
  "InstanceIds": {
    "InstanceId": [
      "r-bp16e70a4338****"
    ]
  }
}

Error codes

HTTP status codeError codeError messageDescription
400Zone.ClosedSpecified zone is closed.The specified Availability Zone is closed
400MissingParameterPeriod is mandatory for this action.-
400InvalidToken.MalformedThe Specified parameter "Token" is not valid.An error has occurred while authenticating the token.
400InvalidInstanceName.MalformedThe Specified parameter "InstanceName" is not valid.The instance name is invalid.
400InvalidPassword.MalformedThe Specified parameter "Password" is not valid.The specified Password parameters do not meet the requirements
400InvalidInstances.MalformedThe Specified parameter "Instances" is not valid.The Instances parameter passed in is invalid.
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.
400InvalidVpcIdRegion.NotSupportedThe Specified vpcId or vSwitchId not supported.-
400ResourceGroupNotExistThe Specified ResourceGroupId does not exist. -
403RealNameAuthenticationErrorYour account has not passed the real-name authentication yet.Your account has not completed real-name verification.

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

Change history

Change timeSummary of changesOperation
2022-02-22The Error code has changedView Change Details