Creates or clones an ApsaraDB for MongoDB sharded cluster instance.

  • Before you call this operation, make sure that you fully understand the billing methods and pricing.
  • For more information about the instance types of ApsaraDB for MongoDB instances, see Instance types.
  • To create standalone and replica set instances, you can call the CreateDBInstance operation.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
RegionId String Yes cn-hangzhou

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

Action String Yes CreateShardingDBInstance

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

ZoneId String No cn-hangzhou-g

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

Engine String Yes MongoDB

The engine of the instance. Set the value to MongoDB.

EngineVersion String Yes 4.4

The engine version of the instance. Valid values:

  • 5.0
  • 4.4
  • 4.2
  • 4.0
  • 3.4
    Note
    • For more information about the limits on database versions and storage engines, see MongoDB versions and storage engines.
    • If you call this operation to clone an instance, set the value to the engine of the source instance.
DBInstanceDescription String No test

The name of the instance. Valid values:

  • The name must start with a letter.
  • The name can contain digits, letters, underscores (_), and hyphens (-).
  • The name must be 2 to 256 characters in length.
SecurityIPList String No 192.168.xx.xx,192.168.xx.xx

The IP addresses in an IP address whitelist. Separate multiple IP addresses with commas (,). Each IP address in the IP address whitelist must be unique. The following types of predicted values are supported:

  • 0.0.0.0/0
  • IP addresses, such as 10.23.12.24.
  • Classless Inter-Domain Routing (CIDR) blocks, such as 10.23.12.0/24. In this case, /24 indicates that the prefix of each IP address is 24-bit long. You can replace 24 with a value within the range of 1 to 32.
    Note
    • A maximum of 1,000 IP addresses and CIDR blocks can be configured for each instance.
    • If you enter 0.0.0.0/0, all IP addresses can access the instance. This may introduce security risks to the instance.
AccountPassword String No 123456Aa

The password of the root account. The password must meet the following requirements:

  • The password must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters.
  • These special characters include ! # $ % ^ & * ( ) _ + - =
  • The password must be 8 to 32 characters in length.
ChargeType String No PrePaid

The billing method of the instance. Valid values:

  • PostPaid: pay-as-you-go.
  • PrePaid: subscription
Note If you specify this parameter to PrePaid, you must also specify the Period parameter.
Period Integer No 1

The subscription period of the instance. Unit: months.

Valid values: 1 to 9, 12, 24, 36, and 60.

Note If you set the ChargeType property to PrePaid, you must configure this property.
NetworkType String No VPC

The network type of the instance. Valid values:

VPC

VpcId String Yes vpc-bp1n3i15v90el48nx****

The VPC ID of the instance.

VSwitchId String Yes vsw-bp1vj604nj5a9zz74****

The vSwitch ID of the instance.

SrcDBInstanceId String No dds-bp11483712c1****

The ID of the source instance.

Note The ID of the source instance. This parameter is required only when you call this operation to clone an instance. If you specify this parameter, you must also specify the RestoreTime parameter.
RestoreTime String No 2022-03-08T02:30:25Z

The point in time to clone the instance, which must be within seven days. Specify the time in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

Note This parameter is required only when you call this operation to clone an instance. If you specify this parameter, you must also specify the SrcDBInstanceId parameter.
ClientToken String No ETnLKlblzczshOTUbOCz****

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 can contain only ASCII characters and cannot exceed 64 characters in length.

StorageEngine String No WiredTiger

The storage engine of the instance. Default value: WiredTiger. Valid values:

  • WiredTiger
  • RocksDB
  • TerarkDB
    Note
    • If you call this operation to clone an instance, set the value to the engine of the source instance.
    • For more information about the limits on database versions and storage engines, see MongoDB versions and storage engines.
AutoRenew String No true

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

  • true
  • false
Note If you set the ChargeType parameter to PrePaid, you must configure this optional parameter.
ProtocolType String No mongodb

The access protocol type of the instance. Valid values:

  • mongodb: the MongoDB protocol
  • dynamodb: the DynamoDB protocol
Mongos.N.Class String Yes mdb.shard.2x.xlarge.d

The instance type of the mongos node. For more information, see Instance types.

Note
  • N specifies the serial number of the mongos node for which the instance type is specified. For example, Mongos.2.Class specifies the instance type of the second mongos node.
  • Valid values for N: 2 to 32.
ReplicaSet.N.Class String Yes dds.shard.standard

The instance type of the shard node. For more information, see Instance types.

Note
  • N specifies the serial number of the shard node for which the instance type is specified. For example, ReplicaSet.2.Class specifies the instance type of the second shard node.
  • Valid values for N: 2 to 32.
ReplicaSet.N.Storage Integer Yes 10

The storage capacity of the shard node. Unit: GB.

Valid values: 10 to 2000.

Note
  • The value must be a multiple of 10.
  • The values that can be specified for this parameter are subject to the instance types. For more information, see Instance types.
  • N specifies the serial number of the shard node for which the storage capacity is specified. For example, ReplicaSet.2.Storage specifies the storage capacity of the second shard node.
ReplicaSet.N.ReadonlyReplicas Integer No 0

The number of read-only nodes in shard node N.

Valid values: 0 to 5. The value must be an integer. Default value: 0.

Note N specifies the serial number of the shard node for which you want to set the number of read-only nodes. ReplicaSet.2.ReadonlyReplicas specifies the number of read-only nodes in the second shard node.
ConfigServer.N.Class String Yes mdb.shard.2x.xlarge.d

The instance type of the Configserver node. Valid value:

  • mdb.shard.2x.xlarge.d: 4 cores, 8 GB (dedicated). Only instances that run MongoDB 4.4 and 5.0 support this instance type.
  • dds.cs.mid :1 core, 2 GB (general-purpose). Only instances that run MongoDB 3.4, 4.0, and 4.2 support this instance type.
ConfigServer.N.Storage Integer Yes 20

The storage capacity of the Configserver node. Unit: GB.

Set the value to 20.

Response parameters

Parameter Type Example Description
RequestId String D8F1D721-6439-4257-A89C-F1E8E9C9****

The ID of the request.

DBInstanceId String dds-bp114f14849d****

Instance IDs.

OrderId String 21010996721****

The ID of the order.

Examples

Sample requests

http(s)://[mongodb.aliyuncs.com/?Action=CreateShardingDBInstance
&RegionId=cn-hangzhou
&ZoneId=cn-hangzhou-g
&Engine=MongoDB
&EngineVersion=4.4
&DBInstanceDescription=test
&SecurityIPList=192.168.xx.xx,192.168.xx.xx
&AccountPassword=123456Aa
&ChargeType=PrePaid
&Period=1
&NetworkType=VPC
&VpcId=vpc-bp1n3i15v90el48nx****
&VSwitchId=vsw-bp1vj604nj5a9zz74****
&ClientToken=ETnLKlblzczshOTUbOCz****
&StorageEngine=WiredTiger
&AutoRenew=true
&ProtocolType=mongodb
&Mongos=[{"Class":"mdb.shard.2x.xlarge.d"}]
&ReplicaSet=[{"Class":"dds.shard.standard","Storage":10,"ReadonlyReplicas":0}]
&ConfigServer=[{"Class":"mdb.shard.2x.xlarge.d","Storage":20}]
&Common request parameters

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<CreateShardingDBInstanceResponse>
    <RequestId>D8F1D721-6439-4257-A89C-F1E8E9C9****</RequestId>
    <DBInstanceId>dds-bp114f14849d****</DBInstanceId>
    <OrderId>21010996721****</OrderId>
</CreateShardingDBInstanceResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "D8F1D721-6439-4257-A89C-F1E8E9C9****",
  "DBInstanceId" : "dds-bp114f14849d****",
  "OrderId" : "21010996721****"
}

Error codes

For a list of error codes, visit the API Error Center.