• Relational Database Service

rds
  1. Help Center
  2. Relational Database Service
  3. API Reference
  4. API v3 (Recommended)
  5. DB Instance Management
  6. Creating a DB Instance

Creating a DB Instance

Function

This API is used to create a single RDS DB instance, primary/standby DB instances, or a read replica.

URI

  • URI format

    PATH: /{version_id}/{project_id}/instances

    Method: POST

  • Parameter description
    Table 1 Parameter description

    Name

    Mandatory

    Description

    version_id

    Yes

    Specifies the API version. It is case-sensitive and the value is v3.

    project_id

    Yes

    Specifies the project ID of a tenant in a region.

Request

  • Parameter description
    Table 2 Parameters for creating primary/standby instances and a single instance

    Name

    Mandatory

    Type

    Description

    name

    Yes

    String

    Specifies the DB instance name. The DB instance name of the same type must be unique for the same tenant.

    The value must be 4 to 64 characters in length and start with a letter. It is case-sensitive and can contain only letters, digits, hyphens (-), and underscores (_).

    datastore

    Yes

    Dictionary data structure

    Specifies the database information.

    For details, see Table 4.

    ha

    No

    Dictionary data structure

    Specifies the HA configuration parameters, which are used when creating primary/standby DB instances.

    For details, see Table 5.

    configuration_id

    No

    String

    Specifies the parameter group ID.

    For details, see id in Table 3 in section Obtaining a Parameter Group List.

    port

    No

    String

    Specifies the database port information.

    • The MySQL database port ranges from 1024 to 65535 (excluding 12017 and 33071, which are occupied by the RDS system and cannot be used).
    • The PostgreSQL database port ranges from 2100 to 9500.
    • The Microsoft SQL Server database port can be 1433 or ranges from 2100 to 9500, excluding 5355 and 5985.

    If this parameter is not set, the default value is as follows:

    • For MySQL, the default value is 3306.
    • For PostgreSQL, the default value is 5432.
    • For Microsoft SQL Server, the default value is 1433.

    password

    Yes

    String

    Specifies the database password.

    Value range:

    The value cannot be empty and should contain 8 to 32 characters, including uppercase and lowercase letters, digits, and the following special characters: ~!@#%^*-_=+?

    You are advised to enter a strong password to improve security, preventing security risks such as brute force cracking.

    backup_strategy

    No

    Dictionary data structure

    Specifies the advanced backup policy.

    For details, see Table 6.

    disk_encryption_id

    No

    String

    Specifies the key ID for disk encryption. The default value is empty.

    flavor_ref

    Yes

    String

    Specifies the specification code. The value cannot be empty.

    For details, see spec_code in Table 3 in section Querying Database Specifications.

    volume

    Yes

    Dictionary data structure

    Specifies the volume information.

    For details, see Table 7.

    region

    Yes

    String

    Specifies the region ID.

    The value cannot be empty. For details about how to obtain this parameter value, see Regions and Endpoints.

    availability_zone

    Yes

    String

    Specifies the AZ ID.

    The value cannot be empty. For details about how to obtain this parameter value, see Regions and Endpoints.

    vpc_id

    Yes

    String

    Specifies the VPC ID. For details about how to obtain this parameter value, see section "Virtual Private Cloud" in the Virtual Private Cloud API Reference.

    Valid value: The value cannot be empty. The string length and whether the string complying with UUID regular expression rules are verified.

    subnet_id

    Yes

    String

    Specifies the subnet information. For details about how to obtain this parameter value, see section "Subnet" in the Virtual Private Cloud API Reference.

    security_group_id

    Yes

    String

    Specifies the security group which the RDS DB instance belongs to. For details about how to obtain this parameter value, see section "Security Group" in the Virtual Private Cloud API Reference.

    charge_info

    No

    Dictionary data structure

    Specifies the billing information, which is pay-per-use. By default, pay-per-use is used.

    For details, see Table 8.

    Table 3 Parameter description (creating read replicas, Microsoft SQL Server read replicas cannot be created through APIs)

    Name

    Mandatory

    Type

    Description

    name

    Yes

    String

    Specifies the DB instance name. The DB instance name of the same type must be unique for the same tenant.

    The value must be 4 to 64 characters in length and start with a letter. It is case-sensitive and can contain only letters, digits, hyphens (-), and underscores (_).

    replica_of_id

    Yes

    String

    Specifies the DB instance ID, which is used to create a read replica.

    For details, see id in Table 3 in section Querying DB Instances Based on Specified Conditions.

    disk_encryption_id

    No

    String

    Specifies the key ID for disk encryption. The default value is empty.

    flavor_ref

    Yes

    String

    Specifies the specification code. The value cannot be empty.

    For details, see spec_code in Table 3 in section Querying Database Specifications.

    volume

    Yes

    Dictionary data structure

    Specifies the volume information.

    The volume size of the read replica must be greater than or equal to that of the primary DB instance.

    For details, see Table 7.

    region

    Yes

    String

    Specifies the region ID.

    The value cannot be empty. For details about how to obtain this parameter value, see Regions and Endpoints.

    availability_zone

    Yes

    String

    Specifies the AZ ID.

    The value cannot be empty. For details about how to obtain this parameter value, see Regions and Endpoints.

    charge_info

    No

    Dictionary data structure

    Specifies the billing information, which is pay-per-use. By default, pay-per-use is used.

    For details, see Table 8.

    Table 4 datastore field data structure description

    Name

    Mandatory

    Type

    Description

    type

    Yes

    String

    Specifies the DB engine. Value:

    • MySQL
    • PostgreSQL
    • SQLServer

    version

    Yes

    String

    Specifies the database version.

    • MySQL databases support MySQL 5.6 and 5.7. Example value: 5.7
    • PostgreSQL databases support PostgreSQL 9.5 and 9.6. Example value: 9.6
    • Microsoft SQL Server databases support 2014 SE, 2016 SE, and 2016 EE. Example value: 2014_SE

    For details about supported database versions, see section Querying the DB Engine Version.

    Table 5 ha field data structure description

    Name

    Mandatory

    Type

    Description

    mode

    Yes

    String

    Specifies the DB instance type. The value is Ha (primary/standby DB instances) and is case-insensitive.

    replication_mode

    No

    String

    Specifies the replication mode for the standby DB instance. This parameter is valid when the mode is Ha.

    Value:

    • For MySQL, the value is async or semisync.
    • For PostgreSQL, the value is async or sync.
    • For Microsoft SQL Server, the value is sync.
    NOTE:
    • async indicates the asynchronous replication mode.
    • semisync indicates the semi-synchronous replication mode.
    • sync indicates the synchronous replication mode.
    Table 6 backupStrategy field data structure description

    Name

    Mandatory

    Type

    Description

    start_time

    Yes

    String

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

    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 any of the following: 00, 15, 30, or 45.

    Example value:

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

    keep_days

    No

    Int

    Specifies the retention days for specific backup files.

    The value range is from 0 to 732. If this parameter is not specified or set to 0, the automated backup policy is disabled.

    NOTICE:

    Primary/standby DB instances of Microsoft SQL Server do not support disabling the automated backup policy.

    Table 7 volume field data structure description

    Name

    Mandatory

    Type

    Description

    type

    Yes

    String

    Specifies the volume type.

    Its value can be any of the following and is case-sensitive:

    • COMMON: indicates the SATA type.
    •  
    • ULTRAHIGH: indicates the SSD type.

    size

    Yes

    Int

    Specifies the volume size.

    Its value range is from 40 GB to 4000 GB. The value must be a multiple of 10.

    NOTICE:

    The volume size of the read replica must be greater than or equal to that of the primary DB instance.

    Table 8 chargeInfo field data structure description

    Name

    Mandatory

    Type

    Description

    charge_mode

    Yes

    String

    Specifies the billing mode.

    The value postPaid indicates the pay-per-use billing mode.

  • Request example

    Creating a single DB instance:

    {
    	"name": "trove-instance-rep2",
    	"datastore": {
    		"type": "MySQL",
    		"version": "5.6"
    	},
    	"flavor_ref": "rds.mysql.s1.large",
    	"volume": {
    		"type": "ULTRAHIGH",
    		"size": 100
    	},
    	"disk_encryption_id": "2gfdsh-844a-4023-a776-fc5c5fb71fb4",
    	"region": "eu-de",
    	"availability_zone": "eu-de-01",
    	"vpc_id": "490a4a08-ef4b-44c5-94be-3051ef9e4fce",
    	"subnet_id": "0e2eda62-1d42-4d64-a9d1-4e9aa9cd994f",
    	"security_group_id": "2a1f7fc8-3307-42a7-aa6f-42c8b9b8f8c5",
    	"port": 8635,
    	"backup_strategy": {
    		"start_time": "08:15-09:15",
    		"keep_days": 12
    	},
    	"charge_info": {
    		"charge_mode": "postPaid"
    	},
    	"password": "Test@12345678",
    	"configuration_id": "452408-ef4b-44c5-94be-305145fg"
    }

    Creating primary/standby DB instances:

    {
    	"name": "trove-instance-rep2",
    	"datastore": {
    		"type": "MySQL",
    		"version": "5.6"
    	},
    	"ha": {
    		"mode": "ha",
    		"replication_mode": "semisync"
    	},
    	"flavor_ref": "rds.mysql.s1.large.ha",
    	"volume": {
    		"type": "ULTRAHIGH",
    		"size": 100
    	},
    	"disk_encryption_id": "2gfdsh-844a-4023-a776-fc5c5fb71fb4",
    	"region": "eu-de",
    	"availability_zone": "eu-de-01,eu-de-02",
    	"vpc_id": "490a4a08-ef4b-44c5-94be-3051ef9e4fce",
    	"subnet_id": "0e2eda62-1d42-4d64-a9d1-4e9aa9cd994f",
    	"security_group_id": "2a1f7fc8-3307-42a7-aa6f-42c8b9b8f8c5",
    	"port": 8635,
    	"backup_strategy": {
    		"start_time": "08:15-09:15",
    		"keep_days": 12
    	},
    	"charge_info": {
    		"charge_mode": "postPaid"
    	},
    	"password": "Test@12345678",
    	"configuration_id": "452408-ef4b-44c5-94be-305145fg"
    }

    Creating a read replica:

    {
    	"name": "trove-instance-rep2",
    	"replica_of_id": "afdsad-fds-fdsagin01",
    	"flavor_ref": "rds.mysql.s1.large.rr",
    	"volume": {
    		"type": "ULTRAHIGH",
    		"size": 100
    	},
    	"disk_encryption_id": "2gfdsh-844a-4023-a776-fc5c5fb71fb4",
    	"region": "eu-de",
    	"availability_zone": "eu-de-01"
    }

Normal Response

  • Parameter description
    Table 9 Parameter description

    Name

    Type

    Description

    instance

    Dictionary data structure

    Indicates the DB instance information.

    For details, see Table 10.

    job_id

    String

    Indicates the ID of the DB instance creation task.

    Table 10 instance field data structure description

    Name

    Type

    Description

    id

    String

    Indicates the DB instance ID.

    NOTE:

    The v3 DB instance ID is incompatible with the v1 DB instance ID.

    name

    String

    Indicates the DB instance name. The name of the DB instance of the same type must be unique for the same tenant.

    The value must be 4 to 64 characters in length and start with a letter. It is case-insensitive and can contain only letters, digits, hyphens (-), and underscores (_).

    status

    String

    Indicates the DB instance status. For example, BUILD indicates that the DB instance is being created.

    datastore

    Dictionary data structure

    Indicates the database information.

    For details, see Table 11.

    ha

    Dictionary data structure

    Indicates the HA configuration parameters, which are used when creating primary/standby DB instances.

    For details, see Table 12.

    configuration_id

    String

    Indicates the parameter group ID.

    port

    String

    Indicates the database port, which is the same as the request parameter.

    backup_strategy

    Dictionary data structure

    Indicates the automated backup policy.

    For details, see Table 13.

    disk_encryption_id

    String

    Indicates the key ID for disk encryption. The default value is empty.

    flavor_ref

    String

    Indicates the specification code. The value cannot be empty.

    For details, see spec_code in Table 3 in section Querying Database Specifications.

    volume

    Dictionary data structure

    Indicates the volume information.

    For details, see Table 14.

    region

    String

    Indicates the region ID.

    The value cannot be empty. For details about how to obtain this parameter value, see Regions and Endpoints.

    availability_zone

    String

    Indicates the AZ ID.

    The value cannot be empty. For details about how to obtain this parameter value, see Regions and Endpoints.

    vpc_id

    String

    Indicates the VPC ID. For details about how to obtain this parameter value, see section "Virtual Private Cloud" in the Virtual Private Cloud API Reference.

    Valid value: The value cannot be empty. The string length and whether the string complying with UUID regular expression rules are verified.

    subnet_id

    String

    Indicates the subnet information. For details about how to obtain this parameter value, see section "Subnet" in the Virtual Private Cloud API Reference.

    security_group_id

    String

    Indicates the security group which the RDS DB instance belongs to.

    For details about how to obtain this parameter value, see section "Security Group" in the Virtual Private Cloud API Reference.

    charge_info

    Dictionary data structure

    Indicates the billing information, which is pay-per-use.

    For details, see Table 15.

    Table 11 datastore field data structure description

    Name

    Mandatory

    Type

    Description

    type

    Yes

    String

    Indicates the DB engine. Value:

    • MySQL
    • PostgreSQL
    • SQLServer

    version

    Yes

    String

    Indicates the database version.

    For details about supported database versions, see section Database Version Queries.

    Table 12 ha field data structure description

    Name

    Mandatory

    Type

    Description

    mode

    Yes

    String

    Indicates the DB instance type. The value is Ha (primary/standby DB instances).

    replication_mode

    No

    String

    Indicates the replication mode for the standby DB instance. This parameter is valid when the mode is Ha.

    Value:

    • For MySQL, the value is async or semisync.
    • For PostgreSQL, the value is async or sync.
    • For Microsoft SQL Server, the value is sync.
    NOTE:
    • async indicates the asynchronous replication mode.
    • semisync indicates the semi-synchronous replication mode.
    • sync indicates the synchronous replication mode.
    Table 13 backupStrategy field data structure description

    Name

    Mandatory

    Type

    Description

    start_time

    Yes

    String

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

    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 any of the following: 00, 15, 30, or 45.

    Example value:

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

    keep_days

    No

    Int

    Indicates the retention days for specific backup files.

    The value range is from 0 to 732. If this parameter is not specified or set to 0, the automated backup policy is disabled.

    Table 14 volume field data structure description

    Name

    Mandatory

    Type

    Description

    type

    Yes

    String

    Indicates the volume type.

    Its value can be any of the following and is case-sensitive:

    • COMMON: indicates the SATA type.
    •  
    • ULTRAHIGH: indicates the SSD type.

    size

    Yes

    Int

    Indicates the volume size.

    Its value range is from 40 GB to 4000 GB. The value must be a multiple of 10.

    Table 15 chargeInfo field data structure description

    Name

    Mandatory

    Type

    Description

    charge_mode

    No

    String

    Indicates the billing information, which is pay-per-use.

  • Response example

    Creating a single DB instance:

    {
    	"instance": {
    		"id": "dsfae23fsfdsae3435in01",
    		"name": "trove-instance-rep2",
    		"datastore": {
    			"type": "MySQL",
    			"version": "5.6"
    		},
    		"flavor_ref": "rds.mysql.s1.large",
    		"volume": {
    			"type": "ULTRAHIGH",
    			"size": 100
    		},
    		"disk_encryption_id": "2gfdsh-844a-4023-a776-fc5c5fb71fb4",
    		"region": "eu-de",
    		"availability_zone": "eu-de-01",
    		"vpc_id": "490a4a08-ef4b-44c5-94be-3051ef9e4fce",
    		"subnet_id": "0e2eda62-1d42-4d64-a9d1-4e9aa9cd994f",
    		"security_group_id": "2a1f7fc8-3307-42a7-aa6f-42c8b9b8f8c5",
    		"port": 8635,
    		"backup_strategy": {
    			"start_time": "08:15-09:15",
    			"keep_days": 3
    		},
    		"configuration_id": "452408-44c5-94be-305145fg",
    		"charge_info": {
    			"charge_mode": "postPaid"
    		}
    	},
    	"job_id": "dff1d289-4d03-4942-8b9f-463ea07c000d"
    }

    Creating primary/standby DB instances:

    {
      "instance":{ 
               "id": "dsfae23fsfdsae3435in01",
               "name": "trove-instance-rep2", 
               "datastore": { 
                 "type": "MySQL", 
                 "version": "5.6" 
                }, 
               "ha": {
                 "mode": "ha",
                 "replication_mode": "semisync"
               },
               "flavor_ref": "rds.mysql.s1.large.ha"
               "volume": { 
                   "type": "ULTRAHIGH", 
                   "size": 100 
                 },
               "disk_encryption_id":  "2gfdsh-844a-4023-a776-fc5c5fb71fb4",
               "region": "eu-de",
               "availability_zone": "eu-de-01,en-de-02",
               "vpc_id": "490a4a08-ef4b-44c5-94be-3051ef9e4fce", 
               "subnet_id": "0e2eda62-1d42-4d64-a9d1-4e9aa9cd994f",
               "security_group_id": "2a1f7fc8-3307-42a7-aa6f-42c8b9b8f8c5", 
               "port": 8635, 
               "backup_strategy": { 
                 "start_time": "08:15-09:15", 
                 "keep_days": 3 
                }, 
               "configuration_id": "452408-44c5-94be-305145fg",
               "charge_info": {
                       "charge_mode": "postPaid"
                                   },
             }
     
     "job_id": "dff1d289-4d03-4942-8b9f-463ea07c000d" 
    }

    Creating a read replica:

    {
      "instance":{ 
                "id": "dsfae23fsfdsae3435in01",
                "name": "trove-instance-rep2", 
                "flavor_ref": "rds.mysql.s1.large.rr",
                 "volume": { 
                   "type": "ULTRAHIGH", 
                   "size": 100 
                 },
               "disk_encryption_id":  "2gfdsh-844a-4023-a776-fc5c5fb71fb4",
               "region": "eu-de",
               "availability_zone": "eu-de-01",
               "vpc_id": "490a4a08-ef4b-44c5-94be-3051ef9e4fce", 
               "subnet_id": "0e2eda62-1d42-4d64-a9d1-4e9aa9cd994f",
               "security_group_id": "2a1f7fc8-3307-42a7-aa6f-42c8b9b8f8c5", 
               "port": 8635, 
               "configuration_id": "452408-44c5-94be-305145fg"
             },
     "job_id": "dff1d289-4d03-4942-8b9f-463ea07c000d"  
    
    }

Abnormal Response

For details, see Abnormal Request Results.