Creates or clones an ApsaraDB for MongoDB replica set 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 sharded cluster instances, you can call the CreateShardingDBInstance 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
Action String Yes CreateDBInstance

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

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.

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.

ZoneId String No cn-hangzhou-b

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

Engine String Yes MongoDB

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

EngineVersion String Yes 4.2

The database engine version of the instance. Valid values:

  • 5.0
  • 4.4
  • 4.2
  • 4.0
  • 3.4
    Note To call this operation to clone an instance, set this value to the database version of the source instance.
DBInstanceClass String Yes dds.mongo.standard

The instance type. For more information about valid values, see Instance types. You can also call the DescribeAvailableResource operation to view instance types.

DBInstanceStorage Integer Yes 10

The storage capacity of the instance. Valid values: 10 to 3000. The value must be a multiple of 10. Unit: GB.

Note The values that can be specified for this parameter are subject to the instance types. For more information, see Instance types.
DBInstanceDescription String No Testdatabase1

The name of the instance. The rules for the name:

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

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.

Note
  • You can enter IP addresses such as 10.23.12.24 and Classless Inter-Domain Routing (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.
  • 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 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, 2, 3, 4, 5, 6, 7, 8, 9, 12, 24, and 36.

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

The network type of the new 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-bp175iuvg8nxqraf2****

The ID of the virtual private cloud (VPC).

Note This parameter is required when the NetworkType parameter is set to VPC.
VSwitchId String Yes vsw-bp1gzt31twhlo0sa5****

The ID of the vSwitch.

Note This parameter is required when the NetworkType parameter is set to VPC.
SrcDBInstanceId String No dds-bp1ee12ad351****

The ID of the source instance.

Note This parameter can only be specified when this operation is called to clone instances. You must also specify the BackupId parameter or RestoreTime parameter.
BackupId String No 32994****

The ID of the backup set.

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.
  • You can call the DescribeBackups operation to query the backup ID.
RestoreTime String No 2019-03-13T12:11:14Z

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.

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 and BackupId parameter.
  • You can set this parameter to a point in time in the last seven days.
BusinessInfo String No {“ActivityId":"000000000"}

The business information. This is an additional parameter.

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 takes effect only when you set the ChargeType parameter to PrePaid.
DatabaseNames String No mongodbtest

The name of the database.

Note When you call this operation to clone an instance, you can set the databases that are specified by this parameter for cloning. Otherwise, all databases of the instance are cloned.
CouponNo String No youhuiquan_promotion_option_id_for_blank

The coupon code. Default value: youhuiquan_promotion_option_id_for_blank.

StorageEngine String No WiredTiger

The storage engine of the instance. Valid values:

  • WiredTiger
  • RocksDB
  • TerarkDB

Default value: WiredTiger.

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

The number of nodes in the replica set. Valid values: 3, 5, or 7. Default value: 3.

ReadonlyReplicas String No 1

The number of read-only nodes. Valid values: 1 to 5.

Note By default, no read-only nodes are created.
ResourceGroupId String No rg-acfmyiu4ekp****

The ID of the resource group.

ClusterId String No dhg-2x7*************

The ID of the ApsaraDB MyBase for MongoDB cluster. To create a ApsaraDB MyBase for MongoDB instance, you must perform the following steps:

1. Log on to the ApsaraDB MyBase console.

2. Create an ApsaraDB MyBase for MongoDB cluster.

3. Add three or more hosts to the cluster.

Note
  • For more information about how to create an ApsaraDB MyBase for MongoDB instance, see Create a dedicated cluster.
  • This parameter is only available on the China site (aliyun.com).

Response parameters

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

The ID of the request.

DBInstanceId String dds-bp144a7f2db8****

The ID of the instance.

OrderId String 21077576248****

The ID of the order.

Examples

Sample requests

http(s)://mongodb.aliyuncs.com/?Action=CreateDBInstance
&ClientToken=ETnLKlblzczshOTUbOCz****
&Engine=MongoDB
&EngineVersion=4.2
&DBInstanceClass=dds.mongo.standard
&DBInstanceStorage=10
&<Common request parameters>

Sample success responses

XML format

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

<CreateDBInstanceResponse>
    <DBInstanceId>dds-bp144a7f2db8****</DBInstanceId>
    <OrderId>21077576248****</OrderId>
    <RequestId>D8F1D721-6439-4257-A89C-F1E8E9C9****</RequestId>
</CreateDBInstanceResponse>

JSON format

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

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

Error codes

HttpCode Error code Error message Description
400 InsufficientBalance Your account does not have enough balance. The error message returned because your account balance is insufficient. Add funds to your account and try again.
400 InvalidCapacity.NotFound The Capacity provided does not exist in our records. The error message returned because the configured capacity is invalid. Check the specified parameter.
400 IdempotentParameterMismatch Request uses a client token in a previous request but is not identical to that request. The error message returned because the two specified requests use the same ClientToken.
403 RealNameAuthenticationError Your account has not passed the real-name authentication yet. The error message returned because the specified user has not completed real-name verification. Complete real-name verification and try again.
403 IncorrectBackupSetState Current backup set state does not support operations. The error message returned because the backup set is in a state that does not support the current operation.

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