tencent cloud

云数据库 MySQL

动态与公告
产品动态
产品公告
新手指引
产品简介
产品概述
产品优势
应用场景
数据库架构
隔离策略
经济型实例
产品功能列表
数据库实例
高可用性(多可用区)
地域和可用区
自研内核
内核概述
内核版本更新动态
功能类特性
性能类特性
安全类特性
稳定类特性
TXRocks 引擎
内核问题检查与修复
购买指南
计费概述
选型指南
购买方式
续费说明
欠费说明
退费说明
按量转包年包月
调整实例费用说明
备份空间收费说明
数据库审计计费说明
数据库代理商业化计费和活动说明
数据库代理计费周期说明
查看费用账单
快速入门
入门概述
创建 MySQL 实例
连接 MySQL 实例
SQL 洞察(原数据库审计)
数据库审计简介
查看审计实例列表
开通审计服务
查看审计日志
日志投递
配置事后告警
修改审计规则
修改审计服务
关闭审计服务
审计规则模板
SQL 审计规则(旧版)
查看审计任务
授权子用户使用数据库审计
MySQL 云盘版
MySQL 云盘版概述
创建 MySQL 云盘版实例
维护管理实例
查看实例监控
调整实例配置
其他功能相关操作
迁移或升级至 MySQL 云盘版
操作指南
使用限制
操作总览
维护管理实例
升级实例
CPU 弹性扩容
只读/灾备实例
数据库代理
数据库管理(DMC)
账号管理
参数配置
备份与回档
数据迁移
网络与安全
监控与告警
日志中心
只读分析引擎
标签
实践教程
腾讯云 MySQL 帮助实现 MySQL 5.7升级至 MySQL 8.0
MySQL 5.6升级到 MySQL 5.7方法和说明
云数据库 MySQL 数据库审计等保实践
构建全场景高可用架构
云数据库 MySQL 使用规范
应用程序配置自动重连功能
MySQL 主实例参数修改的影响
MyISAM 自动转换为 InnoDB 引擎限制
为云数据库 MySQL 创建 VPC
使用云数据库 MySQL 提高业务负载能力
两地三中心灾备建设
读写分离扩展云数据库 MySQL 性能
使用 DTS 将 InnoDB 数据迁移至 RocksDB
构建 LAMP 堆栈 Web 应用程序
构建 Drupal 网站
通过 Python 语言使用 MySQL API
主备实例查询数据不一致
白皮书
性能白皮书
安全白皮书
故障处理
连接相关
性能相关
实例数据同步延迟
设置大小写不敏感失败
通过命令获取 slow_query_log_file 失败
API 文档
History
Introduction
API Category
Instance APIs
调用方式
Data Import APIs
Database Proxy APIs
数据库审计相关接口
Security APIs
Task APIs
Backup APIs
Account APIs
Rollback APIs
Parameter APIs
Database APIs
Monitoring APIs
Log-related API
Data Types
Error Codes
常见问题
选型相关
计费相关
备份相关
回档相关
连接登录
参数修改
升级相关
账号权限
性能内存
运维相关
数据迁移
功能特性
控制台相关
日志相关
事件相关
数据库审计
实例切换影响
API 2.0 切换 3.0 指引
相关协议
服务等级协议
服务条款
通用参考
标准与认证
联系我们
词汇表

CreateDBInstanceHour

PDF
聚焦模式
字号
最后更新时间: 2025-10-28 22:19:30

1. API Description

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

This API is used to create a pay-as-you-go TencentDB instance (which can be a source, 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. You can use the DescribeDBZoneConfig API to query the purchasable instance specifications, and then use the DescribeDBPrice API to query the prices of the purchasable instances.
  2. You can create up to 100 instances at a time, with an instance validity period of up to 36 months.
  3. MySQL 5.5, 5.6, 5.7, and 8.0 are supported.
  4. Source instances, disaster recovery instances, and read-only instances can be created.
  5. If Port, ParamList, or Password is specified in the input parameters, the instance will be initialized.

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

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 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 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, 8.0. You can use the DescribeDBZoneConfig API to query the supported 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.
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 Region information of the source instance, which is required when purchasing a read-only or disaster recovery instance.
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 The availability zone information of Replica 2, which is left empty by default. Specify this parameter when purchasing a source instance in the one-source-two-replica architecture.
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 For multiple instances purchased at one time, they will be distinguished by the name suffix number, such as instnaceName=db and goodsNum=3, and their instance names are db1, db2, and db3, respectively.
ResourceTags.N No Array of TagInfo Instance tag information.
DeployGroupId No String Placement group ID.
ClientToken No String A unique string supplied by the client to ensure that the request is idempotent. Its maximum length is 64 ASCII characters. If this parameter is not specified, the idempotency of the request cannot be guaranteed.
DeviceType No String Instance resource isolation type. Valid values: UNIVERSAL (general instance), EXCLUSIVE (dedicated instance), BASIC (basic instance). Default value: UNIVERSAL.
ParamTemplateId No Integer Parameter template ID.
AlarmPolicyList.N No Array of Integer Array of alarm policy IDs, which is OriginId obtained through the DescribeAlarmPolicy API.
InstanceNodes No Integer The number of nodes of the instance. To purchase a read-only replica or a basic instance, set this parameter to 1 or leave it empty. To purchase a three-node instance, set this parameter to 3 or specify the BackupZone parameter. If the instance to be purchased is a source instance and both BackupZone and this parameter are left empty, the value 2 will be used, which indicates the source instance will have two nodes.
Cpu No Integer The number of CPU cores of the instance. If this parameter is left empty, the number of CPU cores depends on the Memory value.
AutoSyncFlag No Integer Whether to automatically start disaster recovery synchronization. This parameter takes effect only for disaster recovery instances. Valid values: 0 (no), 1 (yes). Default value: 0.
CageId No String Financial cage ID.
ParamTemplateType No String Type of the default parameter template. Valid values: HIGH_STABILITY (high-stability template), HIGH_PERFORMANCE (high-performance template). Default value: HIGH_STABILITY.
AlarmPolicyIdList.N No Array of String The array of alarm policy names, such as ["policy-uyoee9wg"]. If the AlarmPolicyList parameter is specified, this parameter is invalid.
DryRun No Boolean Whether to check the request without creating any instance. Valid values: true, false (default). After being submitted, the request will be checked to see if it is in correct format and has all required parameters with valid values. An error code is returned if the check failed, and RequestId is returned if the check succeeded. After a successful check, no instance will be created if this parameter is set to true, whereas an instance will be created and if it is set to false.
EngineType No String Instance engine type. Valid values: InnoDB (default); RocksDB.
Vips.N No Array of String The list of IPs for sources instances. Only one IP address can be assigned to a single source instance. If all IPs are used up, the system will automatically assign IPs to the remaining source instances that do not have one.

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, 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.

4. Example

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

This example shows you how to create a pay-as-you-go TencentDB instance.

Input Example

POST / HTTP/1.1Host: cdb.intl.tencentcloudapi.comContent-Type: application/jsonX-TC-Action: CreateDBInstanceHour<common request parameters>{    "ResourceTags": [        {            "TagKey": "marchtest",            "TagValue": [                "test1"            ]        }    ],    "Zone": "ap-guangzhou-3",    "UniqVpcId": "vpc-0akbol5v",    "ProjectId": "0",    "SlaveZone": "ap-guangzhou-3",    "InstanceRole": "master",    "GoodsNum": "1",    "DeployMode": "0",    "Volume": "25",    "EngineVersion": "5.6",    "UniqSubnetId": "subnet-fyrtjbqw",    "Memory": "1000",    "ProtectMode": "0"}

Output Example

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

5. Developer Resources

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.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.

帮助和支持

本页内容是否解决了您的问题?

填写满意度调查问卷,共创更好文档体验。

文档反馈