Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Creating a DB Instance

Updated on 2025-02-10 GMT+08:00

Function

This API is used to create a DB instance. Before calling this API:

NOTICE:

This API will be unavailable on March 31, 2025. You are advised to switch workloads to the new API (Creating a DB Instance) before then.

URI

  • URI format

    POST https://{endpoint}/mysql/v3/{project_id}/instances

  • Example

    POST https://{endpoint}/mysql/v3/0483b6b16e954cb88930a360d2c4e663/instances

  • Parameter description
    Table 1 Parameter description

    Name

    Mandatory

    Description

    project_id

    Yes

    Project ID of a tenant in a region.

    To obtain this value, see Obtaining a Project ID.

Request

Table 2 Parameter description

Name

Mandatory

Type

Description

charge_info

No

Object

Billing mode, which is yearly/monthly or pay-per-use (default setting).

For details, see Table 3.

Note:

You cannot create yearly/monthly instances in a DeC.

name

Yes

String

DB instance name.

Instances of the same type can have same names under the same tenant.

The value consists of 4 to 64 characters and starts with a letter. It is case-sensitive and contains only letters, digits, hyphens (-), and underscores (_).

datastore

Yes

Object

Database information.

For details, see Table 4.

mode

Yes

String

DB instance type, which is case-insensitive. Currently, only the cluster type is supported.

flavor_ref

Yes

String

Specification code.

For details, see Table 3.

vpc_id

Yes

String

VPC ID. To obtain this value, use either of the following methods:

  • Method 1: Log in to the VPC console and view the VPC ID on the VPC details page.
  • Method 2: See "Querying VPCs" in the Virtual Private Cloud API Reference.

subnet_id

Yes

String

Network ID. To obtain this value, use either of the following methods:

  • Method 1: Log in to the VPC console and click the target subnet on the Subnets page. You can view the network ID on the displayed page.
  • Method 2: See "Querying Subnets" in the Virtual Private Cloud API Reference.

security_group_id

No

String

Security group ID.

If network ACL is enabled, this parameter cannot be specified. If network ACL is disabled, this parameter is mandatory.

  • Method 1: Log in to VPC console. Choose Access Control > Security Groups in the navigation pane on the left. On the displayed page, click the target security group. You can view the security group ID on the displayed page.
  • Method 2: See "Querying Security Groups" in the Virtual Private Cloud API Reference.

configuration_id

No

String

Parameter template ID.

password

Yes

String

Database password.

Values:

The password consists of 8 to 32 characters and contains at least three types of the following: uppercase letters, lowercase letters, digits, and special characters ~!@#%^*-_=+?

You are advised to enter a strong password to improve security and prevent security risks such as brute force cracking. If you enter a weak password, the system automatically determines that the password is invalid.

backup_strategy

No

Object

Automated backup policy.

For details, see Table 5.

time_zone

No

String

UTC time zone.

  • If this parameter is not specified, UTC is used by default.
  • If this parameter is specified, the value ranges from UTC-12:00 to UTC+12:00 at the full hour. For example, the parameter can be UTC+08:00 rather than UTC+08:30.

availability_zone_mode

Yes

String

AZ type. It can be single or multi.

master_availability_zone

If availability_zone_mode is set to multi, this parameter is mandatory.

If availability_zone_mode is set to single, this parameter cannot be specified.

String

Primary AZ.

slave_count

Yes

Integer

Number of read replicas. The value is from 1 to 9. An instance contains up to 15 read replicas.

region

Yes

String

Region ID.

The value cannot be empty. To obtain this value, see Regions and Endpoints.

volume

No

Object

Volume information. This parameter is optional during the creation of yearly/monthly instances.

For details, see Table 6.

enterprise_project_id

No

String

Enterprise project ID. This parameter is mandatory when the enterprise project is enabled, and cannot be specified when the enterprise project is disabled.

lower_case_table_names

No

Integer

Whether a kernel table name is case-sensitive. If the value is 1 (by default), the table name is case-insensitive. If the value is 0, the table name is case-sensitive.

tags

No

Array of objects

Tag list. Instances are created based on tag keys and values.

  • {key} indicates the tag key. It must be unique and cannot be empty.
  • {value} indicates the tag value, which can be empty.

To create instances with multiple tag keys and values, separate key-value pairs with commas (,). Up to 20 key-value pairs can be added.

For details, see Table 7.

Table 3 charge_info field data structure description

Name

Mandatory

Type

Description

charge_mode

Yes

String

Billing mode.

Values:

  • prePaid: indicates the yearly/monthly billing mode.
  • postPaid: indicates the pay-per-use billing mode.

period_type

No

String

Subscription period.

Values:

  • month: The service is subscribed by month.
  • year: The service is subscribed by year.
    NOTE:

    This parameter is valid and mandatory if charge_mode is set to prePaid.

period_num

No

Integer

Subscription duration. This parameter is valid and mandatory if charge_mode is set to prePaid.

Values:

  • When period_type is set to month, the parameter value ranges from 1 to 9.
  • When period_type is set to year, the parameter value ranges from 1 to 3.
Table 4 datastore field data structure description

Name

Mandatory

Type

Description

type

Yes

String

DB engine. Currently, only gaussdb-mysql is supported.

version

Yes

String

DB version.

For details about supported DB versions, see Querying Version Information About a DB Engine.

Table 5 backup_strategy field data structure description

Name

Mandatory

Type

Description

start_time

Yes

String

Automated backup start time. The automated backup will be triggered within one hour after the time specified by this parameter.

The value cannot be empty. It must be a valid value in the "hh:mm-HH:MM" format. The current time is in the UTC format.

  • The HH value must be 1 greater than the hh value.
  • The values of mm and MM must be the same and must be set to 00.

Example value:

  • 21:00-22:00
Table 6 volume field data structure description

Name

Mandatory

Type

Description

size

Yes

Integer

Disk size. The default value is 40 GB.

The value ranges from 40 GB to 128,000 GB and must be a multiple of 10.

Table 7 tags field data structure description

Name

Mandatory

Type

Description

key

Yes

String

Tag key. It contains a maximum of 36 Unicode characters.

The value cannot be an empty string, a space, or left blank.

Only uppercase letters, lowercase letters, digits, hyphens (-), and underscores (_) are allowed.

value

Yes

String

Tag value. It contains a maximum of 43 Unicode characters.

It can be an empty string.

Only uppercase letters, lowercase letters, digits, periods (.), hyphens (-), and underscores (_) are allowed.

NOTE:

The value of region in the following is used as an example.

  • Request example
    {
    "charge_info":{
            "charge_mode":"postPaid"
        },
        "region":"xxx",
        "name":"gaussdb-2d34",
        "datastore":{
            "type":"gaussdb-mysql",
            "version":"8.0"
        },
        "mode":"Cluster",
        "flavor_ref":"gaussdb.mysql.large.x86.4",
        "vpc_id":"f7ee62e2-9705-4523-ba49-a85ea1a1fa87",
        "subnet_id":"140af7bf-a9da-4dcf-8837-34199fd6d186",
        "security_group_id":"c7f69884-fe2b-4630-8114-70a11499d902",
        "configuration_id":"43570e0de32e40c5a15f831aa5ce4176pr07",
        "password":"xxxx",
        "backup_strategy":{
            "start_time":"17:00-18:00"
        },
        "time_zone":"UTC+08:00",
        "availability_zone_mode":"multi",
        "master_availability_zone":"az1pod1",
        "slave_count":1,
        "enterprise_project_id":"0",
        "lower_case_table_names":1
    }

Response

  • Normal response
    Table 8 Parameter description

    Name

    Type

    Description

    instance

    Object

    Instance information.

    For details, see Table 9.

    job_id

    String

    DB instance creation task ID.

    This parameter is returned only when pay-per-use DB instances are created.

    order_id

    String

    Order ID. This parameter is returned only when yearly/monthly instances are created.

    Table 9 instance field data structure description

    Name

    Type

    Description

    id

    String

    DB instance ID.

    name

    String

    DB instance name. Instances of the same type can have same names under the same tenant.

    The value consists of 4 to 64 characters and starts with a letter. It is case-insensitive and contains only letters, digits, hyphens (-), and underscores (_).

    status

    String

    DB instance status.

    This parameter is returned only when pay-per-use DB instances are created.

    datastore

    Object

    Database information.

    For details, see Table 10.

    mode

    String

    DB instance type. Currently, only the cluster type is supported.

    configuration_id

    String

    Parameter template ID.

    port

    String

    Database port, which is the same as the request parameter.

    backup_strategy

    Object

    Automated backup policy.

    For details, see Table 11.

    enterprise_project_id

    String

    Enterprise project ID, which is the same as the request parameter.

    region

    String

    Region ID, which is the same as the request parameter.

    availability_zone_mode

    String

    AZ type, which is the same as the request parameter.

    master_ availability_zone

    String

    Primary AZ ID.

    vpc_id

    String

    VPC ID, which is the same as the request parameter.

    security_group_id

    String

    Security group ID, which is the same as the request parameter.

    subnet_id

    String

    Subnet ID, which is the same as the request parameter.

    flavor_ref

    String

    Specification code, which is the same as the request parameter.

    For details, see Table 3.

    charge_info

    Object

    Billing mode, which is yearly/monthly or pay-per-use.

    For details, see Table 12.

    Table 10 datastore field data structure description

    Name

    Type

    Description

    type

    String

    DB Engine

    version

    String

    DB version.

    Table 11 backup_strategy field data structure description

    Name

    Type

    Description

    start_time

    String

    Backup time window. Automated backups will be triggered during the backup time window.

    keep_days

    Integer

    Backup retention days.

    Table 12 charge_info field data structure description

    Name

    Type

    Description

    charge_mode

    String

    Billing mode, which is yearly/monthly or pay-per-use.

    period_num

    Integer

    Subscription duration, which is calculated by month.

    This parameter is valid when charge_mode is set to prePaid (this parameter is valid only for yearly/monthly instances).

NOTE:

The values of region and master_availability_zone are used as examples.

  • Example normal response
    {
        "instance":{
            "id":"5eebbb4c0f9f4a99b42ed1b6334569aain07",
            "name":"gaussdb-2d34",
            "status":"BUILD",
            "datastore":{
                "type":"gaussdb-mysql",
                "version":"8.0"
            },
            "mode":"Cluster",
            "configuration_id": "",
            "port":null,
            "backup_strategy":{
                "start_time":null,
                "keep_days":"7"
            },
            "enterprise_project_id": "0",
            "region":"aaa",
            "availability_zone_mode":"multi",
            "master_availability_zone":"aaa",
            "vpc_id":"f7ee62e2-9705-4523-ba49-a85ea1a1fa87",
            "security_group_id":"c7f69884-fe2b-4630-8114-70a11499d902",
            "subnet_id":"140af7bf-a9da-4dcf-8837-34199fd6d186"
            "charge_info":{
                "charge_mode":"postPaid"
            },
            "flavor_ref":"gaussdb.mysql.large.x86.4"
        },
        "job_id":"43672fe5-56bd-47f1-8fd1-595cded08a7c"
        }

Status Code

For details, see Status Codes.

Error Code

For details, see Error Codes.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback