Creating a DB Instance

Function

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

URI

Request

Table 2 Parameter description

Name

Mandatory

Type

Description

name

Yes

String

Instance name.

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

The name must consist of 4 to 64 characters and start with a letter. It can contain only letters (case-sensitive), digits, hyphens (-), and underscores (_).

datastore

Yes

Object

Database information.

For details, see Table 3.

ha

Yes

Object

Instance deployment model. For details, see Table 4.

configuration_id

No

String

Parameter template ID. If this parameter is not specified, the default parameter template is used and this parameter is not returned in the response body.

port

No

String

Port number used by the database to provide services for external systems, ranging from 1024 to 39998. It cannot be set to the default value 8000. The following ports are not allowed: 2378, 2379, 2380, 4999, 5000, 5999, 6000, 6001, 8097, 8098, 12016, 12017, 20049, 20050, 21731, 21732, 32122, 32123, and 32124.

password

Yes

String

Database password.

The password must:

Consist of 8 to 32 characters, including at least three of the following: uppercase letters, lowercase letters, digits, and special characters (~!@#$%^&*()-_=+|[{}];:,<.>/?).

Enter a strong password to improve security, preventing security risks such as brute force cracking.

backup_strategy

No

Object

Backup policy.

For details, see Table 5.

disk_encryption_id

No

String

Key ID for disk encryption. The default value is empty.

flavor_ref

Yes

String

Specification code. The value cannot be empty. For details on how to obtain the GaussDB specification code, see DB Instance Specifications.

volume

Yes

Object

Volume information.

For details, see Table 6.

region

Yes

String

Region ID.

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

availability_zone

Yes

String

AZ ID.

The value cannot be left blank. You can deploy GaussDB in the same AZ or across three different AZs, and use commas (,) to separate AZs. For example:

  • To deploy a DB instance in the same AZ, enter three same AZ IDs.
  • To deploy a DB instance across three different AZs, enter three different AZ IDs.

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

vpc_id

Yes

String

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

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

subnet_id

Yes

String

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 section "Querying Subnets" in the Virtual Private Cloud API Reference.
  • Method 2: See section "Querying Subnets" under "APIs" or "Querying Networks" under "OpenStack Neutron APIs" in Virtual Private Cloud API Reference.

security_group_id

Yes

String

Security group which the instance is associated with. 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 section "Querying Security Groups" in the Virtual Private Cloud API Reference.

charge_info

No

Object

Billing type.

For details, see Table 7.

time_zone

No

String

UTC time zone.

  • If this parameter is not specified, GaussDB uses UTC 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.

sharding_num

No

Integer

This parameter is available only for distributed instances. Number of shards.

coordinator_num

No

Integer

This parameter is available only for distributed instances. Number of CNs. The number of CNs cannot exceed twice the number of shards.

replica_num

No

Integer

Number of replicas. The value can be 2 or 3 (default).

Table 3 datastore field data structure description

Name

Mandatory

Type

Description

type

Yes

String

DB engine. Value:

GaussDB. It is case-insensitive.

version

No

String

DB engine version. If this parameter is not specified, the latest version is used by default.

For details, see Querying DB Engine Versions.

Table 4 ha field data structure description

Name

Mandatory

Type

Description

mode

Yes

String

Deployment model. Its value is enterprise for distributed instances and centralization_standard for primary/standby instances. It is case-insensitive.

consistency

Yes

String

Transaction consistency type. The value can be strong or eventual and is case-insensitive.

replication_mode

Yes

String

Replication mode for the standby node.

Value:

sync

NOTE:

sync indicates synchronous replication.

Table 5 backup_strategy field data structure description

Name

Mandatory

Type

Description

start_time

Yes

String

Backup time window. The creation of an automated backup 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 00.

Example value:

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

keep_days

No

Integer

Retention days for specific backup files.

Value: 0 to 732. If this parameter is not specified or is set to 0, the default value 7 is used.

Table 6 volume field data structure description

Name

Mandatory

Type

Description

type

Yes

String

Disk type.

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

size

Yes

Integer

Storage. For example, if this parameter is set to 40, 40 GB of storage is allocated to the created instance.

ECS deployment: The value must be a multiple of (Number of shards x 40 GB), ranging from (Number of shards x 40 GB) to (Number of shards x 16 TB).

Table 7 chargeInfo field data structure description

Name

Mandatory

Type

Description

charge_mode

Yes

String

Billing mode. The value can only be postPaid.

Creating an instance of the enterprise edition:
{
    "name": "user1-v3-independent", 
    "datastore": {
        "type": "GaussDB", 
        "version": "1.4"
    }, 
    "flavor_ref": "gaussdb.opengauss.ee.dn.m4.2xlarge.8.in", 
    "volume": {
        "type": "ULTRAHIGH", 
        "size": 120
    },
    "disk_encryption_id": "24ae42b5-4009-4ea2-b66a-0b211e424dab",
    "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": "xxxxxx", 
    "configuration_id": "b000d7c91f1749da87315700793a11d4pr14", 
    "time_zone": "UTC+08:00",
    "ha":{
        "mode":"enterprise",
        "consistency":"strong",
        "replication_mode":"sync",
        "consistency_protocol":"quorum"
    },
    "sharding_num": 1,
    "coordinator_num": 1,
    "replica_num": 3,
    "port":8000,
    "enable_force_switch":true
}

Response

Status Code

Error Code

For details, see Error Codes.