Domain name for API request: cdb.intl.tencentcloudapi.com.
This API is used to create a cloud database instance with an annual/monthly subscription, including primary instance, disaster recovery instance, and read-only instance. You can create a cloud database instance by importing instance specification, MySQL version number, purchase period, and quantity information.
This API is an asynchronous API. You can also use the query instance list API (https://www.tencentcloud.com/document/api/236/15872?from_cn_redirect=1) to query the instance details. When the Status of the instance 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: CreateDBInstance. |
| 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. |
| 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. |
| Period | Yes | Integer | Instance duration, measurement unit: month, optional values include [1,2,3,4,5,6,7,8,9,10,11,12,24,36]. |
| GoodsNum | Yes | Integer | Instance count. Default value is 1, minimum value 1, maximum value 100. |
| 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. |
| 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. The default project is used if left empty. When you purchase a read-only instance or disaster recovery instance, the project ID is consistent with the primary instance by default. |
| Port | No | Integer | Custom port. Supported range: [1024-65535]. |
| InstanceRole | No | String | Instance type. Supported values include: master - primary instance, dr - disaster recovery instance, ro - read-only instance. |
| MasterInstanceId | No | String | Instance ID, required when purchasing 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. |
| 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. |
| 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. |
| 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. |
| DeployMode | No | Integer | Multiple Availability Zones, defaults to 0. Supported values include: 0 - means single availability zone, 1 - means multi-availability zone. |
| 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. |
| ParamList.N | No | Array of ParamInfo | Parameter list. The parameter format is ParamList.0.Name=auto_increment&ParamList.0.Value=1. You can query the configurable parameters by referring to querying the default configurable parameter list. |
| 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. |
| AutoRenewFlag | No | Integer | Auto-renewal flag. Available values are: 0 - no auto-renewal; 1 - auto-renewal. Default is 0. |
| MasterRegion | No | String | Region of the primary instance. This field is required when you purchase a disaster recovery or RO 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 parameter. This parameter is required when you purchase a read-only instance. |
| InstanceName | No | String | Instance name. When you purchase multiple instances only once, suffix numbers are used for case-sensitive instance naming. For example, instnaceName=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 default value is 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 is 2, meaning a dual-node instance will be purchased. 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. |
| 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 perform a pre-check only for this request. true: Send a check request without creating an instance. Check items include whether required parameters are filled, request format, and service limit. If the check fails, return the corresponding error code; if the check passes, return RequestId. false: Send a normal request and create an instance directly after the check passes. |
| 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 edition) 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. |
| 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 | Billing sub-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: CreateDBInstance
<Common request parameters>
{
"Memory": 1000,
"Volume": 200,
"Period": 12,
"GoodsNum": 1,
"Zone": "ap-guangzhou-ziyan3",
"UniqVpcId": "vpc-grpykq9v",
"UniqSubnetId": "subnet-aq06sf6a",
"Port": 3306,
"InstanceRole": "master",
"Password": "190228bh",
"ProtectMode": 1,
"DeployMode": 0,
"SlaveZone": "ap-guangzhou-ziyan3",
"SecurityGroup": [
"sg-9c3k3gtd"
],
"InstanceName": "test_create-api2",
"InstanceNodes": 2,
"Cpu": 1,
"EngineType": "InnoDB"
}
{
"Response": {
"DealIds": [
"20251117217021754844851"
],
"InstanceIds": [
"cdb-4wixd9pn"
],
"RequestId": "bae642bd-305a-40fe-b64c-356dc809977b"
}
}
POST / HTTP/1.1
Host: cdb.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateDBInstance
<Common request parameters>
{
"RoGroup": {
"RoGroupMode": "allinone",
"RoGroupName": "jersey",
"RoMaxDelayTime": 5,
"MinRoInGroup": 1,
"RoOfflineDelay": 1
},
"GoodsNum": 1,
"InstanceRole": "ro",
"MasterInstanceId": "cdb-fn3f9xpx",
"Period": 1,
"Volume": 100,
"Memory": 4000
}
{
"Response": {
"RequestId": "6EF60BEC-0242-43AF-BB20-270359FB54A7",
"DealIds": [
"20171205110051"
],
"InstanceIds": [
"cdbro-hlpl4ik9"
]
}
}
POST / HTTP/1.1
Host: cdb.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateDBInstance
<Common request parameters>
{
"Memory": 1000,
"Volume": 25,
"Period": 1,
"GoodsNum": 1,
"Zone": "ap-beijing-3",
"UniqVpcId": "vpc-4pagx2lk",
"UniqSubnetId": "subnet-a2eaqb1t",
"InstanceRole": "master",
"EngineVersion": "8.0",
"ParamList": [
{
"Name": "lower_case_table_names",
"Value": "0"
}
],
"DeviceType": "UNIVERSAL",
"Cpu": 1,
"EngineType": "InnoDB"
}
{
"Response": {
"RequestId": "6166b535-64e8-4372-86fc-d6e25791f4fc",
"InstanceIds": [
"cdb-grq113rc"
],
"DealIds": [
"20250519054092411681521"
]
}
}
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.CauthError | Authentication failed. |
| InternalError.CdbError | System error. |
| InternalError.DatabaseAccessError | Internal database error. |
| InternalError.DfwError | Security group operation error. |
| InternalError.FtpError | File transfer exception |
| 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. |
Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback