Updated on 2025-12-15 GMT+08:00

Creating a DB Instance

Function

This API is used to create a single-node or primary/standby FlexusRDS instance.

This API allows you to set the X-Client-Token request header in the HTTP request header when you create a FlexusRDS instance, to ensure the request idempotence. For details, see Idempotent Requests.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see the required permissions in Permissions and Supported Actions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    rds:instance:create

    write

    -

    -

    -

    -

URI

  • URI format

    POST /v3/{project_id}/instances

  • Parameter description
    Table 1 Parameters

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Definition

    Project ID of a tenant in a region.

    For details about how to obtain the project ID, see Obtaining a Project ID.

    Constraints

    N/A

    Range

    N/A

    Default Value

    N/A

Request

Table 2 Parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Definition

Instance name.

Constraints

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

Range

The instance name must start with a letter and consist of 4 to 64 characters. Only letters (case-sensitive), digits, hyphens (-), underscores (_), and periods (.) are allowed.

Default Value

N/A

datastore

Yes

Object

Definition

Database information.

For details, see Table 3.

Constraints

N/A

flavor_ref

Yes

String

Definition

Specification code.

Constraints

N/A

Range

The value cannot be empty. For details, see spec_code in Table 3 of Querying Database Specifications.

Default Value

N/A

volume

Yes

Object

Definition

Instance storage. For details, see Table 6.

Constraints

N/A

region

Yes

String

Definition

Region ID.

Constraints

N/A

Range

The value cannot be empty. For details, see Regions and Endpoints.

Default Value

N/A

availability_zone

Yes

String

Definition

AZ ID.

Constraints

If the DB instance is not a single-node instance, you need to specify an AZ for each node of the instance and separate the AZs with commas (,).

Range

The value cannot be empty. For details, see Regions and Endpoints.

Default Value

N/A

ha

No

Object

Definition

HA configuration. For details, see Table 4.

Constraints

This parameter is used only when you create a primary/standby instance.

port

No

String

Definition

Database port.

Constraints

N/A

Range

  • If this parameter is not specified, the default value is 3306.
  • If this parameter is specified, the value range is from 1024 to 65535 (excluding 12017 and 33071, which are occupied by the RDS system and cannot be used).

Default Value

3306

password

No

String

Definition

Database password.

Constraints

Enter a strong password to improve security and prevent security risks such as brute force cracking. If the password you provide is considered weak, the system will prompt you to enter a stronger one.

Range

A database password must be 8 to 32 characters long and contain at least three types of the following characters: uppercase letters, lowercase letters, digits, and special characters. The allowed special characters include ~!@#$%^*-_=+?,()&.

Default Value

N/A

backup_strategy

No

Object

Definition

Advanced backup policy. For details, see Table 5.

Constraints

N/A

charge_info

Yes

Object

Definition

Yearly/Monthly billing information. For details, see Table 7.

Constraints

N/A

time_zone

No

String

Definition

UTC time zone.

Constraints

N/A

Range

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

Default Value

UTC+08:00

tags

No

Array of objects

Definition

Tag list. Each DB instance can be associated with tag key–value pairs while being created.

For details, see Table 8.

Constraints

If you want to create DB instances with multiple tag key–value pairs, separate them with commas (,). A maximum of 20 key–value pairs can be added for an instance.

is_flexus

Yes

boolean

Definition

Whether to create a FlexusRDS instance.

Constraints

N/A

Range

true

Default Value

N/A

Table 3 datastore field data structure description

Parameter

Mandatory

Type

Description

type

Yes

String

Definition

DB engine.

Constraints

N/A

Range

MySQL

Default Value

N/A

version

Yes

String

Definition

DB engine version.

Constraints

N/A

Range

5.7 or 8.0

Default Value

N/A

Table 4 ha field data structure description

Parameter

Mandatory

Type

Description

mode

Yes

String

Definition

Instance type.

Constraints

N/A

Range

HA (case-insensitive)

Default Value

N/A

replication_mode

Yes

String

Definition

Replication mode for the standby instance.

Constraints

N/A

Range

  • async: asynchronous replication
  • semisync: semi-synchronous replication

Default Value

N/A

Table 5 backup_strategy field data structure description

Parameter

Mandatory

Type

Description

start_time

Yes

String

Definition

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

Constraints

N/A

Range

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

  • 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, 15, 30, or 45.

Example:

  • 08:15-09:15
  • 23:00-00:00

Default Value

N/A

keep_days

No

Integer

Definition

Retention days for backups.

Constraints

N/A

Range

  • If this parameter is not specified, the default value 7 is used.
  • If this parameter is specified, the value range is from 0 to 732. 0 indicates that the automated backup policy is disabled. To extend the retention period, contact customer service. Automated backups can be retained for up to 2,562 days.

Default Value

7

Table 6 volume field data structure description

Parameter

Mandatory

Type

Description

type

Yes

String

Definition

Storage type.

Constraints

N/A

Range

CLOUDSSD (case-sensitive): cloud SSD storage. This storage type is supported only with general-purpose and dedicated instances.

Default Value

N/A

size

Yes

Integer

Definition

Storage space.

Constraints

N/A

Range

40–4000, in GB. The value must be a multiple of 10.

Default Value

N/A

Table 7 charge_info field data structure description

Parameter

Mandatory

Type

Description

charge_mode

Yes

String

Definition

Billing mode.

Constraints

N/A

Range

prePaid: yearly/monthly billing

Default Value

N/A

period_type

Yes

String

Definition

Subscription type.

Constraints

N/A

Range

  • month: monthly subscription.
  • year: yearly subscription.

Default Value

N/A

period_num

Yes

Integer

Definition

Subscription period.

Constraints

N/A

Range

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

Default Value

N/A

is_auto_renew

No

boolean

Definition

Whether automatic renewal is enabled for yearly/monthly instances. The renewal period is the same as the original period, and the order will be automatically paid.

Constraints

N/A

Range

  • true: indicates that automatic renewal is enabled.
  • false: indicates that automatic renewal is disabled. The default value is false.

Default Value

false

is_auto_pay

No

boolean

Definition

Whether the order will be automatically paid. This parameter does not affect the payment method of automatic renewal.

Constraints

N/A

Range

  • true: indicates the order will be automatically paid.
  • false: indicates the order will be manually paid. The default value is false.

Default Value

false

Table 8 tags field data structure description

Parameter

Mandatory

Type

Description

key

Yes

String

Definition

Tag key.

Constraints

N/A

Range

It must consist of 1 to 128 Unicode characters.

It can contain letters, digits, spaces, and special characters _.:=+-@. However, it cannot start or end with a space, or start with _sys_.

Default Value

N/A

value

Yes

String

Definition

Tag value.

Constraints

N/A

Range

It can be left blank or contain a maximum of 255 Unicode characters.

It can contain letters, digits, spaces, and special characters _.:=+-@.

Default Value

N/A

Example Request

The values of region and availability_zone in the example request are only for reference.

  • Create a single-node FlexusRDS instance.
    POST https://{endpoint}/v3/0483b6b16e954cb88930a360d2c4e663/instances
    
    {
    	"name": "flexusrds-instance",
    	"datastore": {
    		"type": "MySQL",
    		"version": "5.7"
    	},
    	"flavor_ref": "rds.mysql.y1.large.2",
    	"volume": {
    		"type": "CLOUDSSD",
    		"size": 100
    	},
    	"region": "aaa",
    	"availability_zone": "bbb",
    	"port": 3306,
    	"backup_strategy": {
    		"start_time": "08:15-09:15",
    		"keep_days": 12
    	},
    	"charge_info": {
    		"charge_mode": "prePaid"
    	},
    	"password": "****",
    	"time_zone": "UTC+04:00",
    	"tags": [
    		{
    			"key": "key1",
    			"value": "value1"
    		},
    		{
    			"key": "key2",
    			"value": "value2"
    		}
    	],
    	"is_flexus": true
    }
  • Create a primary/standby FlexusRDS instance.
    {
    	"name": "flexusrds-instance-ha",
    	"datastore": {
    		"type": "MySQL",
    		"version": "5.7"
    	},
    	"ha": {
    		"mode": "ha",
    		"replication_mode": "semisync"
    	},
    	"flavor_ref": "rds.mysql.y1.xlarge.2.ha",
    	"volume": {
    		"type": "CLOUDSSD",
    		"size": 100
    	},
    	"region": "aaa",
    	"availability_zone": "bbb",
    	"port": 3306,
    	"backup_strategy": {
    		"start_time": "08:15-09:15",
    		"keep_days": 12
    	},
    	"charge_info": {
    		"charge_mode": "prePaid"
    	},
    	"password": "****",
           "tags": [
    		{
    			"key": "key1",
    			"value": "value1"
    		},
    		{
    			"key": "key2",
    			"value": "value2"
    		}
    	],
    	"is_flexus": true
    }

Response

  • Normal response
    Table 9 Parameters

    Parameter

    Type

    Description

    instance

    Object

    Definition

    Instance information. For details, see Table 10.

    order_id

    String

    Definition

    Order ID.

    Range

    N/A

    Table 10 instance field data structure description

    Parameter

    Type

    Description

    id

    String

    Definition

    Instance ID.

    Range

    N/A

    name

    String

    Definition

    Instance name. Instances of the same type can have the same name under the same tenant.

    Range

    The value is the same as that of the corresponding request parameter.

    status

    String

    Definition

    Instance status.

    Range

    BUILD: indicates that the instance is being created.

    datastore

    Object

    Definition

    Database information. For details, see Table 11.

    ha

    Object

    Definition

    HA configuration. This parameter is returned only when primary/standby instances are created.

    For details, see Table 12.

    port

    String

    Definition

    Database port.

    Range

    The value is the same as that of the corresponding request parameter.

    backup_strategy

    Object

    Definition

    Automated backup policy. For details, see Table 13.

    flavor_ref

    String

    Definition

    Specification code.

    Range

    The value is the same as that of the corresponding request parameter.

    volume

    Object

    Definition

    Volume information. For details, see Table 14.

    region

    String

    Definition

    Region ID.

    Range

    The value is the same as that of the corresponding request parameter.

    availability_zone

    String

    Definition

    AZ ID.

    Range

    The value is the same as that of the corresponding request parameter.

    vpc_id

    String

    Definition

    VPC ID.

    Range

    vpc-default-smb

    subnet_id

    String

    Definition

    Subnet ID.

    Range

    subnet-default-smb

    security_group_id

    String

    Definition

    Security group which the instance is associated with.

    Range

    sg-default-smb

    charge_info

    Object

    Definition

    Billing information. For details, see Table 15.

    Table 11 datastore field data structure description

    Parameter

    Type

    Description

    type

    String

    Definition

    DB engine.

    Range

    MySQL

    version

    String

    Definition

    DB engine version.

    Range

    5.7 or 8.0

    Table 12 ha field data structure description

    Parameter

    Type

    Description

    mode

    String

    Definition

    Instance type.

    Range

    HA (case-insensitive)

    replication_mode

    String

    Definition

    Replication mode for the standby instance.

    Range

    • async: asynchronous replication
    • semisync: semi-synchronous replication
    Table 13 backupStrategy field data structure description

    Parameter

    Type

    Description

    start_time

    String

    Definition

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

    Range

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

    • 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, 15, 30, or 45.

    Example:

    • 08:15-09:15
    • 23:00-00:00

    If backup_strategy in the request body is empty, 02:00-03:00 is returned for start_time by default.

    keep_days

    Integer

    Definition

    Retention days for backups.

    Range

    0–732. 0 indicates that the automated backup policy is disabled. To extend the retention period, contact customer service. Automated backups can be retained for up to 2,562 days.

    If backup_strategy in the request body is empty, 7 is returned for keep_days by default.

    Table 14 volume field data structure description

    Parameter

    Type

    Description

    type

    String

    Definition

    Storage type.

    Range

    CLOUDSSD (case-sensitive): cloud SSD storage. This storage type is supported only with general-purpose and dedicated instances.

    size

    Integer

    Definition

    Storage space.

    Range

    40–4000, in GB. The value must be a multiple of 10.

    Table 15 chargeInfo field data structure description

    Parameter

    Type

    Description

    charge_mode

    String

    Definition

    Billing mode.

    Range

    prePaid: yearly/monthly billing

    period_num

    Integer

    Definition

    Subscription period.

    Range

    The value is the same as that of the corresponding request parameter.

The values of region and availability_zone in the example response are only for reference.

  • Example normal response

    Single-node FlexusRDS instance created.

    {
    	"instance": {
    		"id": "dsfae23fsfdsae3435in01",
    		"name": "flexusrds-instance",
    		"datastore": {
    			"type": "MySQL",
    			"version": "5.7"
    		},
    		"flavor_ref": "rds.mysql.y1.large.2",
    		"volume": {
    			"type": "CLOUDSSD",
    			"size": 100
    		},
                    "region": "aaa",
    		"availability_zone": "bbb",
    		"vpc_id": "490a4a08-ef4b-44c5-94be-3051ef9e4fce",
    		"subnet_id": "0e2eda62-1d42-4d64-a9d1-4e9aa9cd994f",
    		"security_group_id": "2a1f7fc8-3307-42a7-aa6f-42c8b9b8f8c5",
    		"port": "3306",
    		"backup_strategy": {
    			"start_time": "08:15-09:15",
    			"keep_days": 3
    		},
    		"charge_info": {
    			"charge_mode": "postPaid"
    		}
    	},
    	"job_id": "dff1d289-4d03-4942-8b9f-463ea07c000d"
    }

    Primary/standby FlexusRDS instance created.

    {
      "instance":{ 
               "id": "dsfae23fsfdsae3435in01",
               "name": "flexusrds-instance-ha", 
               "datastore": { 
                 "type": "MySQL", 
                 "version": "5.7" 
                }, 
               "ha": {
                 "mode": "ha",
                 "replication_mode": "semisync"
               },
               "flavor_ref": "rds.mysql.y1.xlarge.2.ha",
               "volume": { 
                   "type": "CLOUDSSD", 
                   "size": 100 
                 },
               "region": "aaa",
               "availability_zone": "bbb,ccc",
               "vpc_id": "490a4a08-ef4b-44c5-94be-3051ef9e4fce", 
               "subnet_id": "0e2eda62-1d42-4d64-a9d1-4e9aa9cd994f",
               "security_group_id": "2a1f7fc8-3307-42a7-aa6f-42c8b9b8f8c5", 
               "port": "3306", 
               "backup_strategy": { 
                 "start_time": "08:15-09:15", 
                 "keep_days": 3 
                }, 
               "charge_info": {
                       "charge_mode": "postPaid"
                                   },
             },
      "job_id": "dff1d289-4d03-4942-8b9f-463ea07c000d" 
    }
  • Abnormal response

    For details, see Abnormal Request Results.

Status Code