Creating a Cluster

Function

This API is used to create clusters.

The cluster must run in a VPC. Before creating a cluster, you need to create a VPC and obtain the VPC and subnet IDs.

This API is an asynchronous API. It takes 10 to 15 minutes to create a cluster.

URI

POST /v1.0/{project_id}/clusters
Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

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

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

cluster

Yes

CreateClusterInfo object

Cluster object

Table 3 CreateClusterInfo

Parameter

Mandatory

Type

Description

node_type

Yes

String

Node type

number_of_node

Yes

Integer

Number of cluster nodes. For a cluster, the value ranges from 3 to 256. For a hybrid data warehouse (standalone), the value is 1.

subnet_id

Yes

String

Subnet ID, which is used for configuring cluster network.

security_group_id

Yes

String

ID of a security group, which is used for configuring cluster network.

vpc_id

Yes

String

VPC ID, which is used for configuring cluster network.

availability_zone

No

String

AZ of a cluster

port

No

Integer

Service port of a cluster. The value ranges from 8000 to 30000. The default value is 8000.

name

Yes

String

Cluster name, which must be unique. The cluster name must contain 4 to 64 characters, which must start with a letter. Only letters, digits, hyphens (-), and underscores (_) are allowed.

user_name

Yes

String

Administrator username for logging in to a GaussDB(DWS) cluster. The administrator username must:

  • Consist of lowercase letters, digits, or underscores.

  • Start with a lowercase letter or an underscore.

  • Contain 1 to 63 characters.

  • Cannot be a keyword of the GaussDB(DWS) database.

user_pwd

Yes

String

Administrator password for logging in to a GaussDB(DWS) cluster

  • Contains 12 to 32 characters.

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

  • Cannot be the same as the username or the username written in reverse order.

public_ip

No

PublicIp object

Public IP address. If the parameter is not specified, public connection is not used by default.

number_of_cn

No

Integer

Number of deployed CNs. The value ranges from 2 to the number of cluster nodes. The maximum value is 20 and the default value is 3.

tags

No

Tags object

Label.

enterprise_project_id

No

String

Enterprise project. The default enterprise project ID is 0.

Table 4 PublicIp

Parameter

Mandatory

Type

Description

public_bind_type

Yes

String

Binding type of an EIP. The value can be one of the following:

  • auto_assign

  • not_use

  • bind_existing

eip_id

No

String

EIP ID

Table 5 Tags

Parameter

Mandatory

Type

Description

key

Yes

String

Key. A tag key can contain a maximum of 128 Unicode characters, which cannot be null. The first and last characters cannot be spaces. Only letters, digits, hyphens (-), and underscores (_) are allowed. It cannot contain the following characters:=*<>\,|/

value

Yes

String

Value. A tag value can contain a maximum of 255 Unicode characters, which can be null. The first and last characters cannot be spaces. Only letters, digits, hyphens (-), and underscores (_) are allowed. It cannot contain the following characters:=*<>\,|/

Response Parameters

Table 6 Response body parameters

Parameter

Type

Description

cluster

Cluster object

Cluster object

Table 7 Cluster

Parameter

Type

Description

id

String

Cluster ID

Example Request

POST  https://{Endpoint}/v1.0/89cd04f168b84af6be287f71730fdb4b/clusters

{
"cluster": {
        "node_type":  "dws.m1.xlarge.ultrahigh",
        "number_of_node": 3,
        "subnet_id": "374eca02-cfc4-4de7-8ab5-dbebf7d9a720",
        "security_group_id": "dc3ec145-9029-4b39-b5a3-ace5a01f772b",
        "vpc_id": "85b20d7e-9eb7-4b2a-98f3-3c8843ea3574",
        "availability_zone": "eu-de-01",
        "port": 8000,
        "name": "dws-1",
        "user_name": "dbadmin",
        "user_pwd": "Password!",
        "public_ip": {
            "public_bind_type": "auto_assign",
            "eip_id": ""
        },
        "enterprise_project_id":"aca4e50a-266f-4786-827c-f8d6cc3fbada"     }
}

Example Responses

{
    "cluster": {
        "id": "7d85f602-a948-4a30-afd4-e84f47471c15"
     }
}

Status Code

Status Code

Description

200

The cluster has been successfully created.

400

Request error.

401

Authentication failed.

403

You do not have required permissions.

500

Internal service error.

503

Service unavailable.