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 most recent region list.

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-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. The value is set to MongoDB.

EngineVersion String Yes 4.4

The engine version of the instance. Valid values:

  • 6.0
  • 5.0
  • 4.4
  • 4.2
  • 4.0
Note If you call this operation to clone an instance, set the value to the engine of the source instance.
DBInstanceClass String Yes dds.mongo.standard

The instance type. You can also call the DescribeAvailableResource operation to view instance types.

DBInstanceStorage Integer Yes 10

The storage capacity of the instance. Unit: GB.

The values that can be specified for this parameter are subject to the instance types. For more information, see Replica set instance types.

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 IP addresses 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-bp175iuvg8nxqraf2****

The VPC ID of the instance.

VSwitchId String Yes vsw-bp1gzt31twhlo0sa5****

The vSwitch ID of the instance.

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. You can call the DescribeBackups operation to query the backup set ID.

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.
RestoreTime String No 2022-03-13T12:11:14Z

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.
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. Default value: false. Valid values:

  • true
  • false
Note If you set the ChargeType parameter to PrePaid, you must configure this optional parameter.
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. Default value: WiredTiger.

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.
ReplicationFactor String No 3

The number of nodes in the replica set instance. Default value: 3. Valid values:

  • 3
  • 5
  • 7
ReadonlyReplicas String No 0

The number of read-only nodes in the replica set instance. Default value: 0. Valid values: 0 to 5.

StorageType String No cloud_essd

The storage type of the instance. Valid values:

  • cloud_essd: enhanced SSD (ESSD)
  • local_ssd: local SSD

Response parameters

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

The ID of the request.

DBInstanceId String dds-bp144a7f2db8****

Instance IDs.

OrderId String 21077576248****

The ID of the order.

Examples

Sample requests

http(s)://mongodb.aliyuncs.com/?Action=CreateDBInstance
&RegionId=cn-hangzhou
&ClientToken=ETnLKlblzczshOTUbOCz****
&ZoneId=cn-hangzhou-g
&Engine=MongoDB
&EngineVersion=4.4
&DBInstanceClass=dds.mongo.standard
&DBInstanceStorage=10
&DBInstanceDescription=test
&SecurityIPList=192.168.xx.xx,192.168.xx.xx
&AccountPassword=123456Aa
&ChargeType=PrePaid
&Period=1
&NetworkType=VPC
&VpcId=vpc-bp175iuvg8nxqraf2****
&VSwitchId=vsw-bp1gzt31twhlo0sa5****
&BusinessInfo={“ActivityId":"000000000"}
&AutoRenew=true
&CouponNo=youhuiquan_promotion_option_id_for_blank
&StorageEngine=WiredTiger
&ReplicationFactor=3
&ReadonlyReplicas=0
&StorageType=cloud_essd
&SecondaryZoneId=cn-hangzhou-h
&HiddenZoneId=cn-hangzhou-i
&Common request parameters

Sample success responses

XML format

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

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

JSON format

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

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

Error codes

HTTP status code Error code Error message Description
400 InvalidDBInstanceDescription.Malformed Specified parameter DBInstanceDescription is not valid. The error message returned because the node name is invalid.
400 InsufficientBalance Your account does not have enough balance. The error message returned because your payment failed. Add another payment method or add funds to your account and then try again.
400 InvalidCapacity.NotFound The Capacity provided does not exist in our records. The error message returned because the specified storage space of the instance is invalid. Specify a value within the valid value range. Unit: MB.
400 IdempotentParameterMismatch Request uses a client token in a previous request but is not identical to that request. The error message returned because the specified ClientToken parameter has been used. Specify a value that has not been used. 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.
403 RealNameAuthenticationError Your account has not passed the real-name authentication yet. The error message returned because you have not completed real-name verification for your Alibaba Cloud account. Complete real-name verification and try again.
403 IncorrectBackupSetState Current backup set state does not support operations. The error message returned because the latest backup set is not ready. Try again later.

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