Updated on 2023-04-27 GMT+08:00

Creating a Cluster (V2)

Function

This API is used to create a cluster with multiple node types (for example, ess, ess-cold, ess-client, ess-master).

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

URI

POST /v2.0/{project_id}/clusters

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain the project ID and name, see Obtaining the Project ID and Name.

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

cluster

Yes

CreateClusterBody object

Cluster object.

Table 3 CreateClusterBody

Parameter

Mandatory

Type

Description

name

Yes

String

Cluster name It can contain 4 to 32 characters. Only digits, letters, hyphens (-), and underscores (_) are allowed. The value must start with a letter.

backupStrategy

No

CreateClusterBackupStrategyBody object

Automatic snapshot creation.

The automatic snapshot creation policy is enabled only if backupStrategy is not left blank.

roles

Yes

Array of CreateClusterRolesBody objects

Cluster information

nics

Yes

CreateClusterInstanceNicsBody object

Subnet ID.

enterprise_project_id

No

String

Enterprise project ID. When creating a cluster, associate the enterprise project ID with the cluster. The value can contain a maximum of 36 characters. It is string 0 or in UUID format with hyphens (-). Value 0 indicates the default enterprise project.

tags

No

Array of CreateClusterTagsBody objects

Cluster tag.

availability_zone

No

String

AZ.

datastore

Yes

CreateClusterDatastoreBody object

Engine type. Currently, only Elasticsearch is supported.

authorityEnable

No

Boolean

Whether to enable authentication. The value can be true or false. Authentication is disabled by default.

  • true: Authentication is enabled for the cluster.
  • false: Authentication is disabled for the cluster.

This parameter is supported in clusters 6.5.4 or later.

httpsEnable

No

Boolean

Whether communication is encrypted on the cluster. The value can be true or false. By default, communication encryption is disabled. If httpsEnable is set to true, authorityEnable must be set to true.- true: Communication is encrypted on the cluster.- false: Communication is not encrypted on the cluster.This parameter is supported in clusters 6.5.4 or later.

adminPwd

No

String

Password of the cluster user admin in security mode. This parameter is mandatory only when authorityEnable is set to true. Input requirements:

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

publicIPReq

No

CreateClusterPublicIpReq object

Public network access information. This parameter is valid only when httpsEnable is set to true.

loadBalance

No

CreateClusterLoadBalance object

VPC endpoint service information

publicKibanaReq

No

CreateClusterPublicKibanaReq object

Kibana public network access information. This parameter is valid only when authorityEnable is set to true.

payInfo

No

PayInfoBody object

Parameters used for purchasing a yearly/monthly cluster.

Table 4 CreateClusterBackupStrategyBody

Parameter

Mandatory

Type

Description

period

Yes

String

Time when a snapshot is automatically created every day. Snapshots can only be created on the hour. The time format is the time followed by the time zone, specifically, HH:mm z. In the format, HH:mm refers to the hour time and z refers to the time zone. For example, 00:00 GMT+08:00 and 01:00 GMT+08:00.

prefix

Yes

String

Prefix of a snapshot that is automatically created, which is manually entered. Enter up to 32 characters and start with a lowercase letter. Lowercase letters, digits, hyphens (-), and underscores (_) are allowed.

keepday

Yes

Integer

Number of days for which automatically created snapshots are retained. Value range: 1 to 90

bucket

No

String

Name of the OBS bucket used for backup.

basePath

No

String

Storage path of the snapshot in the OBS bucket.

agency

No

String

IAM agency used to access OBS.

If none of the bucket, base_path, and agency parameters are specified, the system will automatically create an OBS bucket and an IAM agency. If the creation fails, you need to manually configure correct parameters.

Table 5 CreateClusterRolesBody

Parameter

Mandatory

Type

Description

flavorRef

Yes

String

Instance flavor. For details about the current instance flavor, see the name attribute in Obtaining the Instance Specifications List.

volume

Yes

CreateClusterInstanceVolumeBody object

Volume information. If flavorRef is set to a local disk flavor, leave this parameter blank. Obtain the the local disk flavor by referring to the diskrange attribute in Obtaining the Instance Specifications List. Currently, the following local disk flavors are supported:

  • ess.spec-i3small
  • ess.spec-i3medium
  • ess.spec-i3.8xlarge.8
  • ess.spec-ds.xlarge.8
  • ess.spec-ds.2xlarge.8
  • ess.spec-ds.4xlarge.8

type

Yes

String

Instance type. Select at least one. Example:

  • ess-master indicates a master node.
  • ess-client indicates a client node.
  • ess-cold indicates a cold data node.
  • ess indicates a data node.

instanceNum

Yes

Integer

Number of instances.

  • If ess is selected, you can set the value to 1 to 32.
    • If both ess and ess-master are selected, you can set the value to 1 to 200.
    • If both ess and ess-client are selected, you can set the value to 1 to 32.
    • If both ess and ess-cold are selected, you can set the value to 32.
  • If ess-master is selected, you can set the value to 3 to 10.
  • If ess-client is selected, you can set the value to 1 to 32.
  • If ess-cold is selected, you can set the value to 1 to 32.
Table 6 CreateClusterInstanceVolumeBody

Parameter

Mandatory

Type

Description

volume_type

Yes

String

Volume type.

  • COMMON: common I/O
  • HIGH: high I/O
  • ULTRAHIGH: Ultra-high I/O

size

Yes

Integer

Volume size. The value must be greater than 0 and a multiple of 4 and 10. Unit: GB

Table 7 CreateClusterInstanceNicsBody

Parameter

Mandatory

Type

Description

vpcId

Yes

String

VPC ID, which is used for configuring cluster network.

netId

Yes

String

Subnet ID (network ID).

securityGroupId

Yes

String

Security group ID.

Table 8 CreateClusterTagsBody

Parameter

Mandatory

Type

Description

key

Yes

String

Tag key. The value can contain 1 to 36 characters. It can only contain digits, letters, hyphens (-), and underscores (_).

value

Yes

String

Tag value. The value can contain 0 to 43 characters. It can only contain digits, letters, hyphens (-), and underscores (_).

Table 9 CreateClusterDatastoreBody

Parameter

Mandatory

Type

Description

version

Yes

String

Version of the CSS cluster engine. For details, see CSS Supported Cluster Versions.

type

Yes

String

Engine type. Elasticsearch is supported.

Table 10 CreateClusterPublicIpReq

Parameter

Mandatory

Type

Description

eip

Yes

CreateClusterPublicEip object

Public network bandwidth.

elbWhiteListReq

Yes

CreateClusterElbWhiteList object

EIP whitelist.

publicBindType

Yes

String

Whether to automatically bind an EIP. Specifies whether to automatically bind an EIP. Currently, only auto_assign is supported.

eipId

No

String

EIP ID.

Table 11 CreateClusterPublicEip

Parameter

Mandatory

Type

Description

bandWidth

Yes

CreateClusterPublicEipSize object

Public network bandwidth.

Table 12 CreateClusterPublicEipSize

Parameter

Mandatory

Type

Description

size

Yes

Integer

Bandwidth range.

Table 13 CreateClusterElbWhiteList

Parameter

Mandatory

Type

Description

enableWhiteList

Yes

Boolean

Whether to enable the public network access control.

whiteList

No

String

Public network access control whitelist. Separate the whitelisted network segments or IP addresses with commas (,), and each of them must be unique.

Table 14 CreateClusterLoadBalance

Parameter

Mandatory

Type

Description

endpointWithDnsName

Yes

Boolean

Whether to enable the private domain name.

  • true: The private zone is enabled.
  • false: The private zone is disabled.

vpcPermissions

No

Array of strings

Access control.

Table 15 CreateClusterPublicKibanaReq

Parameter

Mandatory

Type

Description

eipSize

Yes

Integer

Bandwidth range.

elbWhiteList

Yes

CreateClusterPublicKibanaElbWhiteList object

Kibana whitelist information.

Table 16 CreateClusterPublicKibanaElbWhiteList

Parameter

Mandatory

Type

Description

whiteList

Yes

String

Whitelist. Separate the whitelisted network segments or IP addresses with commas (,), and each of them must be unique.

enableWhiteList

Yes

Boolean

Whether to enable the Kibana access control.

Table 17 PayInfoBody

Parameter

Mandatory

Type

Description

payModel

Yes

Integer

Subscription period type.

  • 2: Monthly
  • 3: Yearly

period

Yes

Integer

Subscribed periods.

  • If payModel is 2, the value range is 1 to 9.
  • If payModel is 3, the value range is 1 to 3.

isAutoRenew

No

Integer

Whether to automatically renew the subscription. If this parameter is not specified, the subscription is not automatically renewed.

  • 1: Yes
  • 2: No (default value)

isAutoPay

No

Integer

Whether an order is automatically paid from your Huawei Cloud account.

  • 1: Yes. (Discounts and coupons are automatically selected. The fee will be automatically deducted from your Huawei Cloud account.) If the automatic payment fails, an unpaid order will be generated, and you need to manually complete the payment. (During manual payment, you can still modify the discounts and coupons that were automatically selected.)
  • 2: No. (The customer needs to manually pay for the bill. Discounts and coupons can be used.) The default value is 0.

Response Parameters

Status code: 200

Table 18 Response body parameters

Parameter

Type

Description

cluster

CreateClusterResp object

Cluster object. For a pay-per-use cluster, only the cluster parameter is returned.

orderId

String

Order ID. For a yearly/monthly cluster, only the ordeld parameter is returned.

Table 19 CreateClusterResp

Parameter

Type

Description

id

String

Cluster ID.

name

String

Cluster name

Example Requests

Example request for creating a yearly/monthly cluster. To create a pay-per-use cluster, delete the payInfo field from the request body.

POST /v2.0/6204a5bd270343b5885144cf9c8c158d/clusters

{
  "cluster" : {
    "name" : "css-cluster",
    "backupStrategy" : {
      "period" : "16:00 GMT+08:00",
      "prefix" : "snapshot",
      "keepday" : 7,
      "bucket" : "OBS-obsName",
      "basePath" : "css_repository/obs-path",
      "agency" : "css_obs_agency"
    },
    "roles" : [ {
      "flavorRef" : "ess.spec-4u8g",
      "volume" : {
        "volume_type" : "COMMON",
        "size" : 100
      },
      "type" : "ess",
      "instanceNum" : 1
    } ],
    "nics" : {
      "vpcId" : "{VPC ID}",
      "netId" : "{NET ID}",
      "securityGroupId" : "{Security group ID}"
    },
    "enterprise_project_id" : 0,
    "tags" : [ {
      "key" : "k1",
      "value" : "v1"
    }, {
      "key" : "k2",
      "value" : "v2"
    } ],
    "availability_zone" : "{Az code}",
    "datastore" : {
      "version" : "{cluster-version}",
      "type" : "elasticsearch"
    },
    "authorityEnable" : true,
    "httpsEnable" : true,
    "adminPwd" : "{password}",
    "publicIPReq" : {
      "eip" : {
        "bandWidth" : {
          "size" : 5
        }
      },
      "elbWhiteListReq" : {
        "enableWhiteList" : true,
        "whiteList" : "127.0.0.1"
      },
      "publicBindType" : "auto_assign",
      "eipId" : null
    },
    "loadBalance" : {
      "endpointWithDnsName" : false,
      "vpcPermissions" : [ "{Account ID}" ]
    },
    "publicKibanaReq" : {
      "eipSize" : 5,
      "elbWhiteList" : {
        "whiteList" : "127.0.0.1",
        "enableWhiteList" : true
      }
    },
    "payInfo" : {
      "payModel" : 2,
      "period" : 1,
      "isAutoRenew" : 1,
      "isAutoPay" : 1
    }
  }
}

Example Responses

Status code: 200

Request succeeded.

Example response for creating a pay-per-use cluster.

{
  "cluster" : {
    "id" : "ef683016-871e-48bc-bf93-74a29d60d214",
    "name" : "ES-Test"
  }
}

Example response for creating a yearly/monthly cluster.

{
  "orderId" : "CS2208241141LY94J"
}

Status Codes

Status Code

Description

200

Request succeeded.

400

Invalid request.

Modify the request before retry.

409

The request could not be completed due to a conflict with the current state of the resource.

The resource that the client attempts to create already exists, or the update request fails to be processed because of a conflict.

412

The server did not meet one of the preconditions contained in the request.

Error Codes

See Error Codes.