Creating a DB Instance

Function

This API is used to create a GaussDB(openGauss) DB instance. GaussDB(openGauss) supports distributed instances.

URI

Request

Table 2 Parameter description (for distributed instance creation)

Name

Mandatory

Type

Description

name

Yes

String

Specifies the DB instance name.

DB 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

Specifies the database information.

For details, see Table 3.

ha

Yes

Object

Used to create a distributed instance. For details, see Table 4.

configuration_id

No

String

Specifies the parameter template ID. If this parameter is not specified, the default parameter template is used.

port

No

String

Specifies the database port.

The GaussDB(openGauss) database port ranges from 1024 to 39998 (excluding the following which are occupied by the system and cannot be used: 2378, 2379, 2380, 4999, 5000, 5999, 6000, 6001, 8097, 8098, 12016, 12017, 20049, 20050, 21731, 21732, 32122, 32123, and 32124).

If this parameter is not specified, the default port 8000 is used.

password

Yes

String

Specifies the database password.

The password cannot be empty and must contain 8 to 32 characters, including at least three 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.

backup_strategy

No

Object

Specifies the backup policy.

For details, see Table 5.

flavor_ref

Yes

String

Specifies the specification code. The value cannot be empty. For details on how to obtain the GaussDB(openGauss) specification code, see Table 1.

volume

Yes

Object

Specifies the volume information.

For details, see Table 6.

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. You can deploy GaussDB(openGauss) in the same AZ or across three different AZs, and use commas (,) to separate AZs. For example:

  • To deploy GaussDB(openGauss) in the same AZ, enter three same AZ IDs.
  • To deploy GaussDB(openGauss) across three different AZs, enter three different AZ IDs.

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. To obtain this parameter value, use either of the following methods:

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

subnet_id

Yes

String

Specifies the network ID. To obtain this parameter value, use either of the following methods:

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

security_group_id

No

String

Specifies the security group which the DB instance belongs to. To obtain this parameter value, use either of the following methods:

  • 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 the "Querying Security Groups" section in the Virtual Private Cloud API Reference.

charge_info

No

Object

Specifies the billing type, which is only pay-per-use.

For details, see Table 7.

sharding_num

Yes

Integer

Specifies the number of shards. The value ranges from 1 to 9.

coordinator_num

Yes

Integer

Specifies the number of CNs. The value ranges from 1 to 9. The number of CNs must be less than or equal to twice the number of shards.

Table 3 datastore field data structure description

Name

Mandatory

Type

Description

type

Yes

String

Specifies the DB engine. Value:

GaussDB(openGauss).

version

Yes

String

Specifies the database version.

The following versions are supported:

  • 1.1
  • 1.2
Table 4 ha field data structure description

Name

Mandatory

Type

Description

mode

Yes

String

Specifies the distributed mode of GaussDB(openGauss). The value is enterprise and is case insensitive.

replication_mode

Yes

String

Specifies the replication mode for the standby node.

Value:

For GaussDB(openGauss), the value is sync.

NOTE:
  • sync indicates the synchronous replication mode.

consistency

Yes

String

Specifies the instance consistency type. The value can be strong or eventual and is case-insensitive.

Table 5 backup_strategy 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

Integer

Specifies the retention days for specific backup files.

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

Table 6 volume field data structure description

Name

Mandatory

Type

Description

type

Yes

String

Specifies the volume type.

The value can only be ULTRAHIGH (case-sensitive), indicating SSD.

size

Yes

Integer

Specifies the volume size.

The value must be a multiple of the number of shards multiplied by 40 GB, ranging from the number of shards multiplied by 40 GB to the number of shards multiplied by 16 TB.

Table 7 chargeInfo field data structure description

Name

Mandatory

Type

Description

charge_mode

Yes

String

Specifies the billing mode. The value can only be postPaid, indicating the pay-per-use billing mode.

Creating a DB instance of the enterprise edition:
{
    "name": "user1-v3-independent", 
    "datastore": {
        "type": "GaussDB(openGauss)", 
        "version": "1.1"
    }, 
    "flavor_ref": "gaussdb.opengauss.ee.dn.m6.2xlarge.8.in", 
    "volume": {
        "type": "ULTRAHIGH", 
        "size": 120
    },
    "region": "eu-de",
     "availability_zone": "eu-de-01,eu-de-01,eu-de-01",
    "vpc_id": "1f011c32-2de2-4aa8-a161-9498dbcef329", 
    "subnet_id": "54a44bec-e36f-441e-86bb-d749ace9c189", 
    "security_group_id": "c6123999-8532-421c-9db6-e078013ff58f", 
    "backup_strategy": {
        "start_time": "17:00-18:00", 
        "keep_days": 7
    }, 
    "charge_info": {
        "charge_mode": "postPaid"
    }, 
    "password": "Gauss_234", 
    "configuration_id": "b000d7c91f1749da87315700793a11d4pr14", 
    "time_zone": "UTC+08:00",
    "ha":{
        "mode":"enterprise",
        "consistency":"strong",
        "replication_mode":"sync"
    },
    "sharding_num":1,
    "coordinator_num":1,
    "port":8000
}

Response

Status Codes

For details, see Status Codes.

Error Codes

For details, see Error Codes.