Create Replica Cluster Instance
Last Updated:2021-12-27
Create a Replica Cluster Instance
Prerequisites
Creating an instance requires identity verification. If failed to pass the identity verification, you can access the identity verification under the security certification on the Baidu Open Cloud official website console for the identity verification.
Description
- This interface is used to create a DocDB for MongoDB instances with the same configuration. Currently, you can only create one instance once.
- To create a prepaid instance, the account cash balance is required to be greater than or equal to the instance fee.
- If the interface is asynchronously created, the instance status can be queried via the designated instance details interface.
Request structure
POST /v{version}/instance?clientToken={clientToken} HTTP/1.1
HOST: mongodb.bj.baidubce.com
Authorization: authorization string
{
"billing":{
"paymentTiming": paymentTiming,
"reservation": {
"reservationLength": reservationLength
}
},
"engineVersion": dbVersion,
"storageEngine": dbEngine,
"dbInstanceCpuCount": dbCpu,
"dbInstanceMemoryCapacity": dbMemory,
"dbInstanceStorage": dbStorage,
"dbInstanceName": dbName,
"accountPassword": password,
"vpcId": vpcId,
"subnets":[
{
"zoneName": zoneName,
"subnetId": subnetId
}
]
}
Request header field
No other special header fields are available except for the common header fields.
Request parameter
Parameter name | Type | Required? | Parameter Position | Description |
---|---|---|---|---|
version | string | Yes | URL Parameter | API version number |
clientToken | string | Yes | Query Parameters | It is an idempotent Token, which is an ASCII character string with a length of no more than 64 bits. |
billing | Billing | Yes | RequestBody parameter | Order and billing-related parameters Structural and value references |
purchaseCount | int | No | RequestBody parameters | The number of instances created in batch. It supports the creation of one instance once, whose default value is 1. |
dbInstanceName | string | No | RequestBody parameter | The instance name is customized by users according to the following requirements: 1) Uppercase and lowercase letters, numbers, Chinese characters, and special characters, such as “-”, "", "_” , "/”, and “.”, are supported, and it must begin with a letter; 2) The length is limited to 1–65 characters; 3) It is not specified by default. If not specified, it is automatically generated at random. |
storageEngine | string | Yes | RequestBody Parameters | Storage engine. Value Reference |
engineVersion | string | Yes | RequestBody parameters | Database version Value Reference |
dbInstanceType | string | No | RequestBody parameters | Instance Types. The default value is replica. [Value Reference]MONGODB/API Reference/Appendix.md#InstanceType#) |
dbInstanceCpuCount | int | Yes | RequestBody Parameters | CPU specifications of replica cluster Value Reference |
dbInstanceMemoryCapacity | int | Yes | RequestBody Parameters | Memory specification of Replica cluster instance, in GB. Value Reference |
dbInstanceStorage | int | Yes | RequestBody Parameters | Storage specification of replica cluster instance, in GB. Value Reference |
accountPassword | string | No | RequestBody Parameters | The password of the “root” account. If it is empty, it generates a random password. The password must have 8 to 32 characters. English characters, numbers, and symbols must exist at the same time. Of which, symbols are limited to "!", "@", "#", "$", "%", "^", "*", and "()". Password need to be encrypted and transmitted. All passwords are encrypted by AES 128bit encryption algorithm. SK is used as the key and the encrypted binary byte stream needs to be converted to hexadecimal and passed to the server as a string. The installation steps are as follows: byte[] bCiphertext= AES(plaintext,SK) String strHex = HexStr(bCiphertext). |
vpcId | string | No | RequestBody Parameters | Means the vpc. If not provided, it is the default vpc. You can query the available vpc by calling the Query VPC List interface. |
subnets | List SubnetModel | No | RequestBody Parameters | If not providd, seelect the default subnet. The list of availability zones can be queried by calling the Query List of Availability Zones interface. |
Return header field
There are no other special header fields except for the common header field.
Return parameter
Parameter Name | Type | Description |
---|---|---|
dbInstanceSimpleModels | List dbInstanceSimpleModel | Instance Information |
Request example
POST /v1/instance?clientToken=be31b98c-5e41-4838-9830-9be700de5a20 HTTP/1.1
HOST: mongodb.bj.baidubce.com
ContentType: application/json
Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2017-11-21T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
{
"billing":{
"paymentTiming": "Prepaid",
"reservation": {
"reservationLength": 1
}
},
"engineVersion": "3.4",
"storageEngine": "WiredTiger",
"dbInstanceCpuCount": 1,
"dbInstanceMemoryCapacity": 2,
"dbInstanceStorage": 5,
"dbInstanceName": "myInstance",
"accountPassword": "be3A@12345",
"vpcId":"vpc-jdni4sh8"
"subnets":[
{
"zoneName": "cn-bj-a",
"subnetId": "sbn-ien9ahe"
}
]
}
Return example
HTTP/1.1 200 OK
x-bce-request-id: 7869616F-7A68-6977-656E-406261696475
Content-Type: application/json
{
"dbInstanceSimpleModels" : [
{
"dbInstanceId": "m-gGWeCM",
"connectionString: "mongodb://root:****@gGWeCMs7y.mongodb.bd.baidubce.com:27017,gGWeCMApo.mongodb.bd.baidubce.com:27017/admin?replicaSet=rep-s0YWZQ",
"port": "27017"
}
]
}