CreateDBInstanceHour

Last updated: 2020-03-04 23:48:22

1. API Description

Domain name for API request: mongodb.tencentcloudapi.com.

This API is used to create a pay-as-you-go TencentDB for MongoDB instance.

A maximum of 20 requests can be initiated per second for this API.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common parameter. The value used for this API: CreateDBInstanceHour.
Version Yes String Common parameter. The value used for this API: 2019-07-25.
Region Yes String Common parameter. For more information, please see the list of regions supported by the product. This API only supports: ap-beijing, ap-shanghai, na-ashburn
Memory Yes Integer Instance memory size in GB
Volume Yes Integer Instance disk size in GB
ReplicateSetNum Yes Integer Number of replica sets. When a replica set instance is created, this parameter must be set to 1. When a sharding instance is created, please see the parameters returned by the DescribeSpecInfo API
NodeNum Yes Integer Number of nodes in each replica set. Currently, the number of nodes in a replica set is fixed at 3, while the number of shards is customizable. For more information, please see the parameter returned by the DescribeSpecInfo API
MongoVersion Yes String Version number. For the specific purchasable versions supported, please see the return result of the DescribeSpecInfo API. The correspondences between parameters and versions are as follows: MONGO_3_WT: MongoDB 3.2 WiredTiger Edition; MONGO_3_ROCKS: MongoDB 3.2 RocksDB Edition; MONGO_36_WT: MongoDB 3.6 WiredTiger Edition
MachineCode Yes String Server type. HIO: high IO; HIO10G: 10-Gigabit high IO
GoodsNum Yes Integer Number of instances. Minimum value: 1. Maximum value: 10
Zone Yes String AZ information in the format of ap-guangzhou-2
ClusterType Yes String Instance type. REPLSET: replica set; SHARD: sharding cluster
VpcId No String VPC ID. If this parameter is not set, the basic network will be selected by default
SubnetId No String VPC subnet ID. If VpcId is set, then SubnetId will be required
Password No String Instance password. If this parameter is not set, you need to set an instance password through the password setting API after creating an instance. The password can only contain 8–16 characters and must contain at least two of the following types of characters: letters, digits, and special characters !@#%^*() |
ProjectId No Integer Project ID. If this parameter is not set, the default project will be used
Tags.N No Array of TagInfo Instance tag information

3. Output Parameters

Parameter Name Type Description
DealId String Order ID
InstanceIds Array of String List of IDs of created instances
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Creating a pay-as-you-go TencentDB instance

Input Example

https://mongodb.tencentcloudapi.com/?Action=CreateDBInstanceHour
&Memory=4
&Volume=250
&ReplicateSetNum=1
&NodeNum=2
&MongoVersion=MONGO_3_WT
&MachineCode=TGIO
&GoodsNum=1
&Zone=ap-guangzhou-3
&ClusterType=REPLSET
&<Common request parameter>

Output Example

{
  "Response": {
    "RequestId": "eaf9b19d-5ad4-4ca2-9fc4-a319aeb9181f",
    "DealId": "20190709160000003502416120946732",
    "InstanceIds": [
      "cmgo-m26c6jsf"
    ]
  }
}

5. Developer Resources

API Explorer

This tool allows online call, signature authentication, SDK code generation and quick search of APIs to greatly improve the efficiency of using TencentCloud APIs.

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
InvalidParameter Invalid parameter.
InvalidParameter.PermissionDenied The current subaccount has no permission to perform this operation.
InvalidParameterValue.ClusterTypeError Invalid instance type.
InvalidParameterValue.InvalidTradeOperation Billing error. Corresponding purchase/renewal/configuration change operations are not allowed for the current instance.
InvalidParameterValue.MachineTypeError Incorrect model.
InvalidParameterValue.MongoVersionError The instance version is incorrect.
InvalidParameterValue.PasswordRuleFailed The password is non-compliant.
InvalidParameterValue.PostPaidInstanceBeyondLimit The number of postpaid instances in a single region exceeds the limit.
InvalidParameterValue.ProjectNotFound The project does not exist.
InvalidParameterValue.RegionError Invalid region.
InvalidParameterValue.ReplicaSetNumError Incorrect number of replica sets (shards).
InvalidParameterValue.SpecNotOnSale Incorrect purchasable specification.
InvalidParameterValue.TagNotFound The specified tag was not found.
InvalidParameterValue.ZoneClosed Instances are not purchasable in this AZ.
InvalidParameterValue.ZoneError Invalid AZ.