Creating a Cluster (V2)
Function
This API is used to create a cluster.
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.
Calling Method
For details, see Calling APIs.
URI
POST /v2/{project_id}/clusters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Project ID. To obtain the value, see Obtaining a Project ID. Constraints N/A Range N/A Default Value N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| cluster | No | V2CreateCluster object | Definition Request body for creating a cluster (V2). Constraints N/A Range N/A Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| name | Yes | String | Definition Cluster name, which must be unique. Constraints N/A Range The value must be unique. It must contain 4 to 64 characters and start with a letter. Only letters, digits, hyphens (-), and underscores (_) are allowed. Default Value N/A |
| flavor | Yes | String | Definition Cluster flavor code. Constraints N/A Range See the flavor code returned by the API for querying flavor. Default Value N/A |
| num_cn | No | Integer | Definition Number of CNs in a cluster. Constraints N/A Range 2 to The number of cluster nodes. Maximum value: 20. Default value: 3. Default Value N/A |
| num_node | Yes | Integer | Definition: Number of nodes in a cluster Constraints: None Range: In cluster mode, the value ranges from 3 to 256. Default Value: None |
| db_name | Yes | String | Definition Administrator username. Constraints N/A Range Contain only lowercase letters, digits, and underscores (). Must start with a lowercase letter or an underscore (). Contain 1 to 63 characters. Cannot be a keyword of the GaussDB(DWS) database. Default Value N/A |
| db_password | Yes | String | Definition Password of the administrator. Constraints N/A Range 12 to 32 characters. At least three types of the following characters: uppercase letters, lowercase letters, digits, and special characters (~!?, .:;-_(){}[]/<>@# %^&*+|=). Cannot be the username or the username spelled backwards. Default Value N/A |
| db_port | Yes | Integer | Definition Cluster database port. Constraints N/A Range 8000 to 30000 Default Value 8000 |
| dss_pool_id | No | String | Definition Dedicated storage pool ID. Generally, you do not need to specify this parameter. Constraints N/A Range N/A Default Value null |
| availability_zones | Yes | Array of strings | Definition AZ information. When creating a 3-AZ cluster, you need to enter three different AZs. Constraints N/A Range To obtain the value, see Querying AZs. Default Value N/A |
| tags | No | Array of Tags objects | Definition Tag information. Constraints N/A Range N/A Default Value N/A |
| vpc_id | Yes | String | Definition VPC ID, which is used for configuring cluster network. Constraints N/A Range N/A Default Value N/A |
| subnet_id | Yes | String | Definition Subnet ID, which is used for configuring the cluster network. Constraints N/A Range N/A Default Value N/A |
| security_group_id | No | String | Definition Security group ID, which is used for configuring the cluster network. Constraints N/A Range N/A Default Value N/A |
| public_ip | No | PublicIp object | Definition Public IP address. If the parameter is not specified, public connection is not used by default. Constraints N/A Range N/A Default Value N/A |
| datastore_version | Yes | String | Definition Cluster version. The selected version must be supported by the flavor. Constraints N/A Range For details about the supported versions, see Querying Flavor Information. Default Value N/A |
| master_key_id | No | String | Definition KMS key ID. Constraints N/A Range N/A Default Value N/A |
| master_key_name | No | String | Definition KMS key name. Constraints N/A Range N/A Default Value N/A |
| crypt_algorithm | No | String | Definition KMS encryption algorithm. Constraints N/A Range N/A Default Value N/A |
| volume | Yes | Volume object | Definition Disk information. Constraints N/A Range N/A Default Value N/A |
| enterprise_project_id | No | String | Definition Enterprise project ID for a cluster. If this parameter is not specified, the default value 0 (indicating that the ID of the default enterprise project) is used. Constraints N/A Range N/A Default Value 0 |
| ipv6_enable | No | Boolean | Definition Network protocol type. It indicates whether IPv6 is supported. By default, IPv6 is not used. If IPv6 is used, the selected subnet must support IPv6. Constraints N/A Range N/A Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| public_bind_type | No | String | Definition: EIP binding type. Constraints: None Range: Default Value: null |
| eip_id | No | String | Definition EIP ID. Constraints N/A Range N/A Default Value null |
| ip_type | No | String | Definition: Specifies the EIP type. Constraints: None Range: None Default Value: null |
| eip_address | No | String | Definition: EIP. Constraints: None Range: None Default Value: null |
| band_width | No | Integer | Definition: Bandwidth. Constraints: None Range: None Default Value: null |
| status | No | String | Definition: EIP status. Constraints: None Range: None Default Value: null |
| error_message | No | String | Definition: Error code of the elastic IP address. Constraints: None Range: None Default Value: null |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| volume | Yes | String | Definition Disk name. Constraints N/A Range Default Value N/A |
| capacity | No | Integer | Definition Disk capacity in GB. Constraints N/A Range N/A Default Value N/A |
| iops | No | Integer | Definition IOPS of an ESSD2 disk. Constraints This parameter is mandatory only when the disk type is ESSD2. Range 100 to 256,000 Default Value N/A |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| cluster | Cluster object | Definition Cluster object. Range N/A |
Example Requests
Create a multi-AZ DWS cluster (Cluster version: 8.2.1. AZs: az1 and az2. Node flavor: dws.m1.xlarge.ultrahigh. Nodes: 3. Disk type: SSD disk with 100 GB capacity. Database port: 8000. Public IP address, security Group ID, Subnet ID, VPC ID are configured).
POST https://{Endpoint}/v2/89cd04f168b84af6be287f71730fdb4b/clusters
{
"cluster" : {
"flavor" : "dws.m1.xlarge.ultrahigh",
"num_node" : 3,
"subnet_id" : "374eca02-cfc4-4de7-8ab5-dbebf7d9a720",
"security_group_id" : "dc3ec145-9029-4b39-b5a3-ace5a01f772b",
"vpc_id" : "85b20d7e-9eb7-4b2a-98f3-3c8843ea3574",
"db_port" : 8000,
"datastore_version" : "8.2.1",
"availability_zones" : [ "az1", "az2" ],
"name" : "dws-1",
"num_cn" : 3,
"db_name" : "dbadmin",
"db_password" : "Passw0rd!951357426",
"public_ip" : {
"public_bind_type" : "auto_assign",
"eip_id" : ""
},
"volume" : {
"volume" : "SSD",
"capacity" : 100
},
"enterprise_project_id" : "aca4e50a-266f-4786-827c-f8d6cc3fbada"
}
} Example Responses
Status code: 200
{
"cluster" : {
"id" : "7d85f602-a948-4a30-afd4-e84f47471c15"
}
} Status Codes
| Status Code | Description |
|---|---|
| 200 | The request for creating a cluster is submitted. |
| 400 | Request error. |
| 401 | Authentication failed. |
| 403 | You do not have required permissions. |
| 500 | Internal server error. |
| 503 | Service unavailable. |