Creating a DB Instance
Function
This API is used to create a GaussDB instance. GaussDB supports distributed instances. Before calling this API:
![](https://support.huaweicloud.com/intl/en-us/api-gaussdb/public_sys-resources/notice_3.0-en-us.png)
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.
- Learn how to authenticate this API.
- Obtain the required region and endpoint.
URI
Parameter |
Mandatory |
Description |
---|---|---|
project_id |
Yes |
Project ID of a tenant in a region. For details about how to obtain the project ID, see Obtaining a Project ID. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
Yes |
String |
DB 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. |
port |
No |
String |
Database port. |
password |
Yes |
String |
Database password. The password cannot be empty and must contain 8 to 32 characters, containing 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. |
enterprise_project_id |
No |
String |
Enterprise project ID. This parameter is suitable only for enterprise tenants. |
flavor_ref |
Yes |
String |
Specification code. The value cannot be empty. To obtain its value, see the spec_code field in Querying Instance Specifications. |
volume |
Yes |
Object |
Volume information. For details, see Table 6. |
region |
Yes |
String |
Region ID. The value cannot be empty. For details about how to obtain this parameter value, see Regions and Endpoints. |
availability_zone |
Yes |
String |
AZ ID. The value cannot be empty. You can deploy GaussDB in the same AZ or across three different AZs, and use commas (,) to separate AZs. For example:
The value cannot be empty. 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 either of the following methods:
|
subnet_id |
Yes |
String |
Network ID of the subnet. To obtain this parameter value, use either of the following methods:
|
security_group_id |
Yes |
String |
Security group which the instance is associated with. To obtain this parameter value, use either of the following methods: If you do not need to specify a security group, contact customer service.
|
charge_info |
No |
Object |
Billing type, which is only pay-per-use. For details, see Table 7. |
time_zone |
No |
String |
UTC time zone.
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
type |
Yes |
String |
DB engine. Value: GaussDB. |
version |
No |
String |
DB engine version. If this parameter is not specified, the latest version is used by default. The following versions are supported:
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
mode |
Yes |
String |
Distributed deployment model. The value enterprise (Enterprise Edition) and is case-insensitive. |
replication_mode |
Yes |
String |
Replication mode for the standby node. Value: sync
NOTE:
sync indicates synchronous replication. |
consistency |
Yes |
String |
Transaction consistency type. The value can be strong or eventual and is case-insensitive. |
Parameter |
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.
Example value:
|
keep_days |
No |
Integer |
Retention days for specific backup files. The value ranges from 1 to 732. The default value 7. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
type |
Yes |
String |
Disk type. The value is ULTRAHIGH (case-sensitive), indicating the SSD. |
size |
Yes |
Integer |
Disk size. For example, if this parameter is set to 40, 40 GB of storage is allocated to the created instance. : The value is from (Number of shards x 40 GB) to (Number of shards x 16 TB) and must be a multiple of (Number of shards x 4). |
Response Parameters
Parameter |
Type |
Description |
---|---|---|
instance |
Object |
Instance information. For details, see Table 9. |
job_id |
String |
Instance creation task ID. This parameter is returned only when pay-per-use instances are created. |
Parameter |
Type |
Description |
---|---|---|
id |
String |
Instance ID. |
name |
String |
DB instance name. Instances of the same type can have same names under the same tenant. The value must consist of 4 to 64 characters and start with a letter. It is case-insensitive and contains only letters, digits, hyphens (-), and underscores (_). |
status |
String |
Instance status. For example, BUILD indicates that the instance is being created. This parameter is returned only when pay-per-use instances are created. |
datastore |
Object |
Database information. For details, see Table 10. |
ha |
Object |
Database deployment model. For details, see Table 11. |
replica_num |
Integer |
Number of replicas. |
port |
String |
Database port, which is the same as the request parameter. |
backup_strategy |
Object |
Automated backup policy. For details, see Table 12. |
enterprise_project_id |
String |
Project ID. |
flavor_ref |
String |
Specification code. The value cannot be empty. |
volume |
Object |
Volume information. For details, see Table 13. |
region |
String |
Region ID. |
availability_zone |
String |
AZ ID. |
vpc_id |
String |
VPC ID. |
subnet_id |
String |
Network ID of the subnet. |
security_group_id |
String |
Security group to which the instance belongs. |
charge_info |
Object |
Payment mode. Only pay-per-use is supported. For details, see Table 14. |
Parameter |
Type |
Description |
---|---|---|
type |
String |
DB engine. Value: GaussDB |
version |
String |
DB engine version. |
Parameter |
Type |
Description |
---|---|---|
mode |
String |
Distributed deployment model. The value enterprise (Enterprise Edition) and is case-insensitive. |
replication_mode |
String |
Replication mode for the standby node. Value:
NOTE:
|
consistency |
String |
(GaussDB reserved parameter) Transaction consistency type. The value can be strong or eventual. |
Parameter |
Type |
Description |
---|---|---|
start_time |
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.
Example value:
If backup_strategy in the request body is empty, 02:00-03:00 is returned for start_time by default. |
keep_days |
Integer |
Retention days for specific backup files. The value ranges from 1 to 732. If backup_strategy in the request body is empty, 7 is returned for keep_days by default. |
Parameter |
Type |
Description |
---|---|---|
type |
String |
Disk type. The value is ULTRAHIGH (case-sensitive), indicating the SSD. |
size |
Integer |
Disk size. When creating a distributed instance, you need to specify the size to be a multiple of (Number of shards x 4 GB). Value range: (Number of shards x 40 GB) to (Number of shards x 16 TB). |
Example Request
- Creating a distributed DB instance in the independent deployment (pay-per-use billing, DB engine 1.4, single AZ, three CNs, three shards, three replicas, and 8 vCPUs and 64 GB)
https://gaussdb-opengauss.ap-southeast-1.myhuaweicloud.com/opengauss/v3/0483b6b16e954cb88930a360d2c4e663/instances { "name": "user1-v3-independent-01", "datastore": { "type": "GaussDB", "version": "1.4" }, "flavor_ref": "gaussdb.opengauss.ee.dn.m6.2xlarge.8.in", "volume": { "type": "ULTRAHIGH", "size": 120 }, "disk_encryption_id": "24ae42b5-4009-4ea2-b66a-0b211e424dab", "region": "aaa", "availability_zone": "bbb,bbb,bbb", "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": "", "enterprise_project_id": "", "time_zone": "UTC+08:00", "ha":{ "mode":"enterprise", "consistency":"strong", "replication_mode":"sync" }, "sharding_num": 3, "coordinator_num": 3, "replica_num": 3, "port":8000, "enable_force_switch":true }
- Creating a distributed DB instance in the independent deployment (one-year yearly/monthly billing, DB engine 1.4, three AZs, three CNs, three shards, three replicas, and 8 vCPUs and 64 GB)
https://gaussdb-opengauss.ap-southeast-1.myhuaweicloud.com/opengauss/v3/0483b6b16e954cb88930a360d2c4e663/instances { "name": "user1-v3-independent-02", "datastore": { "type": "GaussDB", "version": "1.4" }, "flavor_ref": "gaussdb.opengauss.ee.dn.m6.2xlarge.8.in", "volume": { "type": "ULTRAHIGH", "size": 120 }, "disk_encryption_id": "24ae42b5-4009-4ea2-b66a-0b211e424dab", "region": "aaa", "availability_zone": "bbb,ccc,ddd", "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": "prePaid", "period_type": "year", "period_num": 1 }, "password": "xxxxxx", "configuration_id": "", "enterprise_project_id": "", "time_zone": "UTC+08:00", "ha":{ "mode":"enterprise", "consistency":"strong", "replication_mode":"sync" }, "sharding_num": 3, "coordinator_num": 3, "replica_num": 3, "port":8000, "enable_force_switch":true }
- Creating a primary/standby (1 primary + 2 standby) DB instance (pay-per-use billing, DB engine 1.4, single AZ, 8 vCPUs and 64 GB)
https://gaussdb-opengauss.ap-southeast-1.myhuaweicloud.com/opengauss/v3/0483b6b16e954cb88930a360d2c4e663/instances { "name": "user1-v3-ha-01", "datastore": { "type": "GaussDB", "version": "1.4" }, "flavor_ref": "gaussdb.opengauss.ee.km1.2xlarge.arm8.ha", "volume": { "type": "ULTRAHIGH", "size": 120 }, "disk_encryption_id": "24ae42b5-4009-4ea2-b66a-0b211e424dab", "region": "aaa", "availability_zone": "bbb,bbb,bbb", "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": "", "enterprise_project_id": "", "time_zone": "UTC+08:00", "ha": { "mode": "centralization_standard", "consistency": "strong", "replication_mode": "sync" }, "replica_num": 3, "port": 8000, "enable_force_switch": true }
- Creating a primary/standby (1 primary + 2 standby) DB instance (one-year yearly/monthly billing, DB engine 1.4, three AZs, 8 vCPUs and 64 GB)
https://gaussdb-opengauss.ap-southeast-1.myhuaweicloud.com/opengauss/v3/0483b6b16e954cb88930a360d2c4e663/instances { "name": "user1-v3-ha-02", "datastore": { "type": "GaussDB", "version": "1.4" }, "flavor_ref": "gaussdb.opengauss.ee.km1.2xlarge.arm8.ha", "volume": { "type": "ULTRAHIGH", "size": 120 }, "disk_encryption_id": "24ae42b5-4009-4ea2-b66a-0b211e424dab", "region": "aaa", "availability_zone": "bbb,ccc,ddd", "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": "prePaid", "period_type": "year", "period_num": 1 }, "password": "xxxxxx", "configuration_id": "", "enterprise_project_id": "", "time_zone": "UTC+08:00", "ha": { "mode": "centralization_standard", "consistency": "strong", "replication_mode": "sync" }, "replica_num": 3, "port": 8000, "enable_force_switch": true }
Example Response
Creating an instance of the enterprise edition
{ "instance": { "id": "ad8cd1440aa94a02ae4580fcbebb3143in14", "name": "user1-v3-independent", "status": "BUILD", "datastore": { "type": "GaussDB", "version": "1.4" }, "ha": { "mode": "Enterprise", "replication_mode": "sync", "consistency": "strong" }, "port": "8000", "volume": { "type": "ULTRAHIGH", "size": 120 }, "replica_num": 3, "backup_strategy": { "start_time": "17:00-18:00", "keep_days": 7 }, "flavor_ref": "gaussdb.opengauss.ee.dn.m6.2xlarge.8.in", "vpc_id": "1f011c32-2de2-4aa8-a161-9498dbcef329", "subnet_id": "54a44bec-e36f-441e-86bb-d749ace9c189", "security_group_id": "c6123999-8532-421c-9db6-e078013ff58f", "charge_info": { "charge_mode": "postPaid" } }, "job_id": "30f2790a-a5b6-4a13-a5ab-733c746609af" }
Status Code
- Normal
- Abnormal
For details, see Status Codes.
Error Code
For details, see Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot