CreateDBInstanceHour

Last updated: 2020-09-11 14:46:39

1. API Description

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

This API is used to create a pay-as-you-go TencentDB instance (which can be a primary, disaster recovery, or read-only instance) by passing in information such as instance specifications, MySQL version number, and quantity.

This is an async API. You can also use the DescribeDBInstances API to query the instance details. If the Status value of an instance is 1 and TaskStatus is 0, the instance has been successfully delivered.

  1. Please use the DescribeDBZoneConfig API to query the supported instance specifications first and then use the DescribeDBPrice API to query the prices of the supported instances;
  2. You can create up to 100 instances at a time, with an instance validity period of up to 36 months;
  3. MySQL v5.5, v5.6, and v5.7 are supported;
  4. primary instances, read-only instances, and disaster recovery instances can be created;
  5. If Port, ParamList, or Password is set in the input parameters, the instance will be initialized.

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

Note: This API supports Finance regions. If the common parameter Region is a Finance region, a domain name with the Finance region needs to be specified, for example: cdb.ap-shanghai-fsi.tencentcloudapi.com

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

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: 2017-03-20.
Region Yes String Common parameter. For more information, please see the list of regions supported by the product.
GoodsNum Yes Integer Number of instances. Value range: 1-100. Default value: 1.
Memory Yes Integer Instance memory size in MB. Please use the DescribeDBZoneConfig API to query the supported memory specifications.
Volume Yes Integer Instance disk size in GB. Please use the DescribeDBZoneConfig API to query the supported disk specifications.
EngineVersion No String MySQL version. Valid values: 5.5, 5.6, 5.7. Please use the DescribeDBZoneConfig API to query the supported instance versions.
UniqVpcId No String VPC ID. If this parameter is not passed in, the basic network will be selected by default. Please use the DescribeVpcs API to query the VPCs.
UniqSubnetId No String VPC subnet ID. If UniqVpcId is set, then UniqSubnetId will be required. Please use the DescribeSubnets API to query the subnet lists.
ProjectId No Integer Project ID. If this is left empty, the default project will be used. Please use the DescribeProject API to get the project ID.
Zone No String AZ information. By default, the system will automatically select an AZ. Please use the DescribeDBZoneConfig API to query the supported AZs.
MasterInstanceId No String Instance ID, which is required and the same as the primary instance ID when purchasing read-only or disaster recovery instances. Please use the DescribeDBInstances API to query the instance IDs.
InstanceRole No String Instance type. Valid values: master (primary instance), dr (disaster recovery instance), ro (read-only instance). Default value: master.
MasterRegion No String AZ information of the primary instance, which is required for purchasing disaster recovery instances.
Port No Integer Custom port. Value range: [1024-65535].
Password No String Sets the root account password. Rule: the password can contain 8-64 characters and must contain at least two of the following types of characters: letters, digits, and special symbols (_+-&=!@#$%^*()). This parameter can be specified when purchasing primary instances and is meaningless for read-only or disaster recovery instances.
ParamList.N No Array of ParamInfo List of parameters in the format of ParamList.0.Name=auto_increment&ParamList.0.Value=1. You can use the DescribeDefaultParams API to query the configurable parameters.
ProtectMode No Integer Data replication mode. Valid values: 0 (async), 1 (semi-sync), 2 (strong sync). Default value: 0. This parameter can be specified when purchasing primary instances and is meaningless for read-only or disaster recovery instances.
DeployMode No Integer Multi-AZ. Valid value: 0 (single-AZ), 1 (multi-AZ). Default value: 0. This parameter can be specified when purchasing primary instances and is meaningless for read-only or disaster recovery instances.
SlaveZone No String AZ information of secondary database 1, which is the Zone value by default. This parameter can be specified when purchasing primary instances and is meaningless for read-only or disaster recovery instances.
BackupZone No String AZ information of secondary database 2, which is empty by default. This parameter can be specified when purchasing strong sync primary instances and is meaningless for other types of instances.
SecurityGroup.N No Array of String Security group parameter. You can use the DescribeProjectSecurityGroups API to query the security group details of a project.
RoGroup No RoGroup Read-only instance information. This parameter must be passed in when purchasing read-only instances.
AutoRenewFlag No Integer This field is meaningless when purchasing pay-as-you-go instances.
InstanceName No String Instance name.
ResourceTags.N No Array of TagInfo Instance tag information.
DeployGroupId No String Placement group ID.
ClientToken No String A string that is used to guarantee the idempotency of the request, which is generated by the user and must be unique in each request on the same day. The maximum length is 64 ASCII characters. If this parameter is not specified, the idempotency of the request cannot be guaranteed.
DeviceType No String Instance type. Valid values: HA (High-Availability Edition), BASIC (Basic Edition). If this parameter is not specified, High-Availability Edition will be used by default.

3. Output Parameters

Parameter Name Type Description
DealIds Array of String Short order ID.
InstanceIds Array of String Instance ID list
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Creating pay-as-you-go TencentDB instance

Input Example

https://cdb.tencentcloudapi.com/?Action=CreateDBInstanceHour
&Memory=1000
&Volume=25
&GoodsNum=1
&Zone=ap-guangzhou-3
&UniqVpcId=vpc-0akbol5v
&UniqSubnetId=subnet-fyrtjbqw
&ProjectId=0
&InstanceRole=master
&EngineVersion=5.6
&ProtectMode=0
&DeployMode=0
&SlaveZone=ap-guangzhou-3
&ResourceTags.0.TagKey=marchtest
&ResourceTags.0.TagValue.0=test1
&<Common request parameters>

Output Example

{
  "Response": {
    "RequestId": "6EF60BEC-0242-43AF-BB20-270359FB54A7",
    "InstanceIds": [
      "cdb-03brtubb"
    ],
    "DealIds": [
      "20171201160000002670226599824833"
    ]
  }
}

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
CdbError Backend or process error.
FailedOperation.StatusConflict Task status conflict.
InternalError.DatabaseAccessError Internal database error.
InternalError.DfwError Security group operation error.
InternalError.TradeError Transaction system error.
InternalError.VpcError VPC or subnet error.
InvalidParameter Parameter error.
OperationDenied.ActionNotSupport Unsupported operation.
OperationDenied.OtherOderInProcess Other orders are being submitted. Please try again later.
OperationDenied.WrongPassword Incorrect password or verification failed.

Was this page helpful?

Was this page helpful?

  • Not at all
  • Not very helpful
  • Somewhat helpful
  • Very helpful
  • Extremely helpful
Send Feedback
Help