Domain name for API request: cdb.intl.tencentcloudapi.com.
This API is used to create pay-as-you-go instances. You can create a cloud database instance by inputting the instance specification, MySQL version number, quantity, etc. It supports the creation of primary instances, disaster recovery instances, and read-only instances.
This API is an async API. You can also use the API for the query (https://www.tencentcloud.com/document/api/236/15872?from_cn_redirect=1) to check the instance details. When the instance Status is 1 and TaskStatus is 0, it means the instance has been delivered successfully.
A maximum of 20 requests can be initiated per second for this API.
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 Params. The value used for this API: CreateDBInstanceHour. |
| Version | Yes | String | Common Params. The value used for this API: 2017-03-20. |
| Region | Yes | String | Common Params. For more information, please see the list of regions supported by the product. |
| GoodsNum | Yes | Integer | Instance count. Default value is 1, minimum value 1, maximum value 100. |
| Memory | Yes | Integer | Instance memory size. Unit: MB. Please use the obtain the purchasable specifications of cloud databases API to obtain creatable memory specifications. |
| Volume | Yes | Integer | Instance disk size, unit: GB. Please use the obtain the purchasable specifications of cloud databases API to get the creatable disk range. |
| EngineVersion | No | String | MySQL version, including 5.5, 5.6, 5.7, and 8.0. Please use the obtain the purchasable specifications of cloud databases API to get the instance version created. |
| UniqVpcId | No | String | VPC ID. Please use Querying VPC List. |
| UniqSubnetId | No | String | Subnet ID in the private network. If UniqVpcId is set up, UniqSubnetId is required. Please use query subnet list. |
| ProjectId | No | Integer | Project ID. If this is left empty, the default project will be used. |
| Zone | No | String | For availability zone information, please use the obtain the purchasable specifications of cloud databases API to get the availability zones where instances can be created. If you create a single-node, two-node, three-node, or four-node instance, this parameter is required. Please specify an availability zone. If you do not specify one, the system will automatically select an availability zone (which may not be the one you want to deploy in). If you create a cloud disk edition instance, leave this parameter blank and configure the availability zones for read-write nodes and read-only nodes with parameter ClusterTopology. |
| MasterInstanceId | No | String | Instance ID, required when you purchase a read-only instance or disaster recovery instance. This field represents the primary instance ID of the read-only instance or disaster recovery instance. Please use the Query Instance List API to query the cloud database instance ID. |
| InstanceRole | No | String | Instance type. Supported values include: master - primary instance, dr - disaster recovery instance, ro - read-only instance. |
| MasterRegion | No | String | Region of the primary instance. This field is required when you purchase a disaster recovery or RO instance. |
| Port | No | Integer | Custom port. Supported range: [1024-65535]. |
| Password | No | String | Set the root account password. The password must contain 8 to 64 characters and at least two of the following: letters, digits, or characters (supported characters: _+-&=!@#$%^*()). You can specify this parameter when purchasing a primary instance. This parameter is invalid when purchasing a read-only instance or disaster recovery instance. |
| ParamList.N | No | Array of ParamInfo | Parameter list. The parameter format is ParamList.0.Name=auto_increment&ParamList.0.Value=1. Query the configurable parameters by referring to querying the default configurable parameter list. |
| ProtectMode | No | Integer | Data replication method, defaults to 0. Supported values include: 0 - means async replication, 1 - means semi-sync replication, 2 - means strong sync replication. You can specify this parameter when purchasing a primary instance. This parameter is invalid when purchasing a read-only instance or disaster recovery instance. |
| DeployMode | No | Integer | Multiple Availability Zones, defaults to 0. Supported values include: 0 - means single availability zone, 1 - means multi-availability zone. Specify this parameter when purchasing the primary instance. This parameter is invalid when purchasing a read-only instance or disaster recovery instance. |
| SlaveZone | No | String | AZ information of standby database 1. For two-node, three-node, or four-node instances, specify this parameter. If not specified, it defaults to the Zone value. For cloud disk edition instances, this parameter is optional. Configure the AZ for read-write and read-only nodes with parameter ClusterTopology. Single-node instances are in a single availability zone, so no need to specify this parameter. |
| BackupZone | No | String | AZ information of standby 2, empty by default. Specify this parameter when you proceed to purchase a three-node primary instance or a four-node primary instance. |
| SecurityGroup.N | No | Array of String | Security group parameters. Use the API Query Project Security Group Information to query security group details of a certain project. |
| RoGroup | No | RoGroup | Read-only instance information. This parameter is required when you purchase a read-only instance. |
| AutoRenewFlag | No | Integer | This field is meaningless for pay-as-you-go instances. |
| InstanceName | No | String | Instance name. When you purchase multiple instances only once, suffix numbers are used for case-sensitive instance naming. For example, instanceName=db and goodsNum=3, the instance names are db1, db2, and db3 respectively. |
| ResourceTags.N | No | Array of TagInfo | Tag information of the instance. |
| DeployGroupId | No | String | Placement group ID. |
| ClientToken | No | String | String used to ensure request idempotency. This string is generated by the customer and must be unique between different requests within 48 hours, with a maximum value of 64 ASCII characters. If not specified, request idempotency cannot be guaranteed. |
| DeviceType | No | String | Instance isolation type. Supported values include: "UNIVERSAL" - general-purpose instance, "EXCLUSIVE" - dedicated instance, "BASIC_V2" - ONTKE single-node instance, "CLOUD_NATIVE_CLUSTER" - CLOUD disk edition standard type, "CLOUD_NATIVE_CLUSTER_EXCLUSIVE" - CLOUD disk edition enhanced. If not specified, it defaults to general-purpose instance. |
| ParamTemplateId | No | Integer | Parameter template ID. |
| AlarmPolicyList.N | No | Array of Integer | Array of alarm policy IDs. OriginId returned by the Tencent Cloud observability platform DescribeAlarmPolicy API. |
| InstanceNodes | No | Integer | Number of instance nodes. For RO and basic edition instances, the value defaults to 1. To purchase a three-node instance, set this value to 3 or specify the BackupZone parameter. When purchasing a primary instance without specifying this parameter or the BackupZone parameter, the default value is 2, which means purchasing a dual-node instance. To purchase a four-node instance, set this value to 4 or specify the FourthZone parameter. |
| Cpu | No | Integer | Number of Cpu cores of the instance. When multiple Cpu configurations exist for the Memory specification (for example, 64000MB Memory corresponds to 8-core/16-core/32-core), the Cpu parameter must be provided. |
| AutoSyncFlag | No | Integer | Whether to automatically initiate disaster recovery sync. This parameter only takes effect when purchasing a disaster recovery instance. Available values are: 0 - Do not automatically initiate disaster recovery sync; 1 - Automatically initiate disaster recovery sync. The default is 0. |
| CageId | No | String | Financial Enclosure ID. |
| ParamTemplateType | No | String | Default parameter template type. Supported values include "HIGH_STABILITY" - HIGH-STABILITY template, "HIGH_PERFORMANCE" - HIGH-PERFORMANCE template. Default value is "HIGH_STABILITY". |
| AlarmPolicyIdList.N | No | Array of String | Alarm policy name array, such as ["policy-uyoee9wg"]. This parameter is invalid when AlarmPolicyList is not empty. |
| DryRun | No | Boolean | Whether to only pre-check this request. true: Send a check request without creating an instance. Check items include required parameters, request format, and service limits. If the check fails, return the corresponding error code; if the check passes, return RequestId. Default false: Send a normal request and create the instance directly after passing the check. |
| EngineType | No | String | Instance engine type, defaults to "InnoDB". Supported values include "InnoDB" and "RocksDB". |
| Vips.N | No | Array of String | Specify the IP list of the instance. Only the primary instance is supported. Process by instance sequence. Handle as unspecified if insufficient. |
| DataProtectVolume | No | Integer | The data protection space size of the cloud disk edition instance, in GB, has a setting range of 1 - 10. |
| ClusterTopology | No | ClusterTopology | Topology configuration for cloud disk edition nodes. |
| DiskType | No | String | Disk type. This parameter can be specified for single-node (cloud disk) or cloud disk edition instances. CLOUD_SSD means SSD Cloud Block Storage, CLOUD_HSSD means enhanced SSD cloud disk, and CLOUD_PREMIUM means high-performance cloud block storage. |
| ClusterType | No | String | ClusterType: cage—Financial Enclosure, cdc—CDB ON CDC; dedicate—dedicated cluster |
| DestroyProtect | No | String | Turn on or off instance destruction protection. on - turn on, off - turn off. |
| FourthZone | No | String | AZ information of standby 3, empty by default. Specify this parameter when you proceed to purchase a four-node primary instance. |
| Parameter Name | Type | Description |
|---|---|---|
| DealIds | Array of String | Short order ID. |
| InstanceIds | Array of String | Instance ID list. |
| RequestId | String | The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. |
POST / HTTP/1.1
Host: cdb.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateDBInstanceHour
<Common request parameters>
{
"GoodsNum": 1,
"Memory": 1000,
"Volume": 150,
"EngineVersion": "8.0",
"UniqVpcId": "vpc-xxxxxx",
"UniqSubnetId": "subnet-xxxxxx",
"ProjectId": 0,
"Zone": "540001",
"InstanceRole": "master",
"Port": 3306,
"ParamList": [
{
"Name": "lower_case_table_names",
"Value": "1"
}
],
"ProtectMode": 1,
"DeployMode": 0,
"SlaveZone": "540001",
"BackupZone": "0",
"SecurityGroup": [
"sg-xxxxx"
],
"InstanceName": "xxxxxxx",
"AlarmPolicyList": [
-1
],
"Cpu": 1,
"ParamTemplateType": "HIGH_STABILITY",
"EngineType": "InnoDB",
"DestroyProtect": "off"
}
{
"Response": {
"DealIds": [
"20260330601111111111"
],
"InstanceIds": [
"cdb-xxxzz"
],
"RequestId": "d30a3795-ee9e-4dc7-bf93-1e7ab751b6f5"
}
}
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.
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.CdbError | System error. |
| InternalError.DatabaseAccessError | Internal database error. |
| InternalError.DfwError | Security group operation error. |
| InternalError.TradeError | Transaction system error. |
| InternalError.UndefinedError | Unknown error |
| InternalError.VpcError | VPC or subnet error. |
| InvalidParameter | Parameter error. |
| InvalidParameter.InstanceNotFound | The instance does not exist. |
| OperationDenied | Operation denied. |
| OperationDenied.ActionNotSupport | Unsupported operation. |
| OperationDenied.OtherOderInProcess | There are other orders being submitted. Please try again later. |
| OperationDenied.UserHasNoStrategy | This account is not authorized to access the requested resource. |
| OperationDenied.WrongPassword | Incorrect password or verification failed. |
文档反馈