Creates or clones an ApsaraDB for MongoDB sharded cluster instance.

Before you call this operation, make sure that you understand the billing methods and pricing of ApsaraDB for MongoDB. For more information, go to the Pricing tab of the ApsaraDB for MongoDB product page at the international site (alibabacloud.com).

For more information about the instance types of ApsaraDB for MongoDB instances, see Instance types.

To create 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 automatically 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 region ID of the instance.

Action String Yes CreateShardingDBInstance

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

ZoneId String No cn-hangzhou-b

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

Engine String Yes MongoDB

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

EngineVersion String Yes 4.0

The version of the database engine. Valid values:

  • 3.4
  • 4.0
  • 4.2
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 database engine of the source instance.
DBInstanceDescription String No Sharded cluster_dtstest1

The name of the instance. The name must meet the following requirements:

  • 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 10.23.12.24/24
  • The whitelist that contains the IP addresses that are allowed to access the instance. Separate multiple IP addresses with commas (,). Each IP address must be unique. A maximum of 1,000 IP addresses can be added.
  • You can enter individual IP addresses such as 10.23.12.24 or CIDR blocks such as 10.23.12.24/24. /24 indicates the length of the CIDR block prefix. The prefix can be 1 to 32 bits in length. You can also enter the percent sign (%) or 0.0.0.0/0.
Note If you enter the percent sign (%) or 0.0.0.0/0, all IP addresses can access the instance. This may introduce security risks to the instance.
AccountPassword String No Alitest!159

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. 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

Default value: PostPaid.

Note If you set 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, and 36.

Note This parameter is valid and required only when ChargeType is set to PrePaid.
NetworkType String No VPC

The network type of the instance. Valid values:

  • Classic
  • VPC

Default value: Classic.

Note If you set this parameter to VPC, you must also specify the VpcId and VSwitchId parameters.
VpcId String Yes vpc-bp1n3i15v90el48nx****

The ID of the VPC.

Note This parameter is valid only when NetworkType is set to VPC.
VSwitchId String Yes vsw-bp1vj604nj5a9zz74****

The ID of the vSwitch.

Note This parameter is valid only when NetworkType is set to VPC.
SrcDBInstanceId String No dds-bp11483712c1****

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 2019-03-08T02:30:25Z

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

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.

Note You can set this parameter to any point in time in the last seven days.
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. Valid values: WiredTiger, RocksDB, and TerarkDB. Default value: WiredTiger.

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 database engine of the source instance.
AutoRenew String No true

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

  • true: enables auto-renewal.
  • false: disables auto-renewal. You must manually renew the instance.

Default value: false.

Note This parameter is valid only when ChargeType is set to PrePaid.
ProtocolType String No mongodb

The type of the access protocol. Valid values:

  • mongodb: the MongoDB protocol
  • dynamodb: the DynamoDB protocol
Mongos.N.Class String No dds.mongos.standard

The instance type of mongos node N. For more information about the valid values, see Instance types. Valid values: 2 to 32.

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.

ReplicaSet.N.Class String No dds.shard.standard

The instance type of shard node N. For more information about the valid values, see Instance types. Valid values: 2 to 32.

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.

ReplicaSet.N.Storage Integer No 20

The storage capacity of shard node N. The values that can be specified for this parameter are subject to the instance types. For more information, see Instance types.

  • Valid values: 10 to 2000. Unit: GB.
  • The value must be a multiple of 10.

N specifies the serial number of the shard node for which storage capacity is specified. For example, ReplicaSet.2.Storage specifies the storage capacity of the second shard node.

ReplicaSet.N.ReadonlyReplicas Integer No 5

The number of read-only nodes in shard node N. Valid values: 0 to 5. Default value: 0.

N specifies the serial number of the shard node for which you want to set the number of read-only nodes. For example, ReplicaSet.2.ReadonlyReplicas specifies the number of read-only nodes in the second mongos node.

Note This parameter is available only for ApsaraDB for MongoDB instances that are purchased on the China site (aliyun.com).
ConfigServer.N.Class String No dds.cs.mid

The instance type of the Configserver node. Set the value to dds.cs.mid.

Note This instance type has 1 vCPU and 2 GB memory. Only one Configserver node is available. For example, set the value of ConfigServer.1.Class to dds.cs.mid.
ConfigServer.N.Storage Integer No 20

The storage capacity of the Configserver node. Set the value to 20.

Note The storage capacity is 20 GB and cannot be changed. The ConfigServer.1.Storage parameter can be set only to 20.

Response parameters

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

The ID of the request.

DBInstanceId String dds-bp114f14849d****

The ID of the instance.

OrderId String 21010996721****

The ID of the order.

Examples

Sample requests

http(s)://mongodb.aliyuncs.com/?Action=CreateShardingDBInstance
&Engine=MongoDB
&EngineVersion=4.0
&AccountPassword=Alitest!159
&ZoneId=cn-hangzhou-b
&ClientToken=ETnLKlblzczshOTUbOCz****
&<Common request parameters>

Sample success responses

XML format

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

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

JSON format

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

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

Error codes

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