Creating a Cluster (V2)
Function
This API is used to create a cluster that uses multiple different types of nodes. The cluster engine type can be Elasticsearch, OpenSearch, or Logstash.
-
Data node (ess): mandatory. Data nodes store the data of a cluster. If there are no client nodes in the cluster, data nodes will need to additionally handle cluster access and data analytics requests; if there are no master nodes, data nodes will need to provide cluster management.
-
Master nodes (ess-master): optional. Master nodes manage cluster-wide operations, including metadata, indexes, and shard allocation. For large-scale deployments, using dedicated master nodes enhances cluster stability, service availability, and centralized control.
-
Client nodes (ess-client): Client nodes route and coordinate search and index requests, offloading processing from data nodes for enhanced query performance and cluster scalability when there are heavy loads.
-
Cold data nodes (ess-cold): Cold data nodes are used to store and query large quantities of latency-insensitive data. They offer an effective way to manage large datasets while cutting storage costs.
-
OpenSearch clusters support the same nodes as Elasticsearch clusters.
-
Logstash clusters support the creation of Logstash nodes (lgs). Logstash nodes ingest, parse, process, and transmit data.
Constraints
Calling Method
For details, see Calling APIs.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, the following identity policy-based permissions are required.
Action
Access Level
Resource Type (*: required)
Condition Key
Alias
Dependencies
css:cluster:create
Write
cluster *
-
-
- ecs:cloudServerFlavors:get
- evs:types:get
- vpc:vpcs:list
- vpc:securityGroups:list
- vpc:securityGroups:get
- vpc:subnets:list
- vpc:subnets:get
- vpc:ports:create
- vpc:ports:update
- vpc:ports:delete
- vpc:ports:get
- kms:cmk:listGrants
- kms:cmk:createGrant
- kms:cmk:list
- kms:cmk:get
- css:cluster:getAgencies
- iam:agencies:listAgencies
- iam:permissions:listRolesForAgency
- iam:permissions:listRolesForAgencyOnProject
- iam:agencies:pass
-
URI
POST /v2.0/{project_id}/clusters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition: Project ID. For details about how to obtain the project ID and name, see Obtaining the Project ID and Name. Constraints: N/A Value range: Project ID of the account. Default value: N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| cluster | Yes | CreateClusterBody object | Definition: Cluster object. Constraints: N/A Value range: N/A Default value: N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| name | Yes | String | Definition: Cluster name. Constraints: N/A Value range: The value must consist of 4 to 32 characters, and must start with a letter. It can only contain digits, letters, periods (.), hyphens (-), and underscores (_). Default value: N/A |
| desc | No | String | Definition: Cluster description. Constraints: Enter a maximum of 128 characters. Value range: Digits, letters, periods (.), hyphens (-), underscores (_), and other special characters are allowed. Default value: N/A |
| backupStrategy | No | Definition: Automatic snapshot creation. Constraints: The automatic snapshot creation policy is enabled only when backupStrategy is not left blank. Value range: N/A Default value: N/A | |
| roles | Yes | Array of CreateClusterRolesBody objects | Definition: Cluster node information. Constraints: N/A Value range: N/A Default value: N/A |
| nics | Yes | Definition: Network configuration information. Constraints: N/A Value range: N/A Default value: N/A | |
| enterprise_project_id | No | String | Definition: Enterprise project ID. When you create a cluster, associate the enterprise project ID with the cluster. Constraints: N/A Value range: The value can contain a maximum of 36 characters. It is string 0 or in UUID format with hyphens (-). Default value: 0 indicates an enterprise project. |
| tags | No | Array of CreateClusterTagsBody objects | Definition: Cluster tags. Constraints: N/A Value range: N/A Default value: N/A |
| availability_zone | Yes | String | Definition The availability zone (AZ) where the nodes are located. Specify the AZ name. Constraints
When selecting multiple AZs, each AZ must contain at least two data nodes (ess) or cold data nodes (ess-cold). If the number of nodes is a multiple of the number of AZs, the nodes are evenly distributed across the AZs. If the number of nodes is not a multiple of the number of AZs, the absolute difference in the number of nodes among AZs must not exceed 1. Range When specifying the AZs of nodes, separate zone names with commas (,). For example, for general AZs, if multiple AZs are selected, availability_zone should be set to region-1a,region-1b,region-1c. Default Value N/A |
| datastore | Yes | CreateClusterDatastoreBody object | Definition: Engine type of the cluster to be created. Constraints: N/A Value range: The value can be elasticsearch, opensearch, or logstash. Default value: N/A |
| authorityEnable | No | Boolean | Definition: Whether to enable security authentication for a cluster. Constraints: This parameter is available only for Elasticsearch and OpenSearch clusters. Value range: Default value: false |
| httpsEnable | No | Boolean | Definition: Whether communication is encrypted on the cluster. Constraints: When httpsEnable is set to true, authorityEnable must be set to true. Only Elasticsearch 6.5.4 security-mode clusters and later support this parameter. HTTPS access can be disabled only for OpenSearch 1.3.6 and 2.19.0 security-mode clusters. For other versions, HTTPS access is forcibly enabled and cannot be disabled. Value range: Default value: false |
| adminPwd | No | String | Definition: Password of the administrator admin for a security-mode cluster. Constraints: This parameter is mandatory only when authorityEnable is set to true during cluster creation. Value range: A string of 8 to 32 characters. Must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters ~!@#$%&*()-_=|[{}];:,<.>/? Default value: N/A |
| publicIPReq | No | CreateClusterPublicIpReq object | Definition: Public network access information. Constraints: This parameter is valid only when httpsEnable is set to true. Value range: N/A Default value: N/A |
| loadBalance | No | CreateClusterLoadBalance object | Definition: VPC endpoint service information. Constraints: N/A Value range: N/A Default value: N/A |
| publicKibanaReq | No | CreateClusterPublicKibanaReq object | Definition: Public network access whitelist for Kibana/Dashboards. Constraints: This parameter is valid only when authorityEnable is set to true. Value range: N/A Default value: N/A |
| payInfo | No | PayInfoBody object | Definition: Parameters used for purchasing a yearly/monthly cluster. Constraints: N/A Value range: N/A Default value: N/A |
| ipv6_enable | No | Boolean | Definition: Whether to enable automatic IPv6 address assignment for the cluster. Constraints: N/A Value range:
Default value: false |
| diskEncryption | No | diskEncryptionInfo object | Definition: Disk encryption information. Constraints: N/A Value range: N/A Default value: N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| flavorRef | Yes | String | Definition: Name flavor name. For details about the current instance flavor, see the name attribute in Obtaining the Instance Specifications List. Constraints: For details about the current instance flavor, see the name attribute in Obtaining the Instance Specifications List. Value range: N/A Default value: N/A |
| volume | Yes | Definition: Volume information. Constraints: If flavorRef is set to a local disk flavor, leave this parameter blank. Obtain the local disk flavor by referring to the diskrange attribute in Obtaining the Instance Specifications List. Value range: N/A Default value: N/A | |
| type | Yes | String | Definition: Node type. Constraints: N/A Value range: [- chinese indicates a Chinese language model. Default value: N/A |
| instanceNum | Yes | Integer | Definition: Number of instances. Constraints: See the value range. Value range: Default value: N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| volume_type | Yes | String | Definition: Disk type. Constraints: N/A Value range: Default value: N/A |
| size | Yes | Integer | Definition: Disk size. Constraints: The value must be greater than 0 and a common multiple of 4 and 10, in GB. Value range: You can obtain the disk size from the diskrange attribute in Obtaining the Instance Specifications List. Default value:
NOTE: For ess and ess-cold nodes, 100 GB or a larger value is recommended. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| vpcId | Yes | String | Definition: VPC ID, which is used for configuring cluster network. Constraints: N/A Value range: N/A Default value: N/A |
| netId | Yes | String | Definition: Subnet ID (network ID). Constraints: N/A Value range: N/A Default value: N/A |
| securityGroupId | Yes | String | Definition: Security group ID. Constraints: N/A Value range: N/A Default value: N/A |
| ips | No | Array of strings | Definition: Node IP address, which is configured when a cluster is created. Constraints: N/A Value range: Only Elasticsearch and OpenSearch support this parameter. Assign automatically: Private IPv4 addresses will be automatically assigned to cluster nodes. Assign manually: Manually assign private IPv4 addresses to cluster nodes. Before assigning an IP address, click View In-Use IP Address to check IP addresses that are already in use. Default value: N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| key | Yes | String | Definition: Tag key. Constraints: N/A Value range: The value can contain 1 to 36 characters. Only digits, letters, hyphens (-), and underscores (_) are allowed. Default value: N/A |
| value | Yes | String | Definition: Tag value. Constraints: N/A Value range: The value can contain 0 to 43 characters. It can only contain digits, letters, hyphens (-), and underscores (_). Default value: N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| version | Yes | String | Definition: Version of the CSS cluster engine. For details, see the supported versions in Before You Start. Constraints: N/A Value range: N/AFor a serverless cluster, logs, search, and vector are supported. Default value: N/A |
| type | Yes | String | Definition: Engine type of the cluster to be created. Constraints: N/A Value range: - serverless-opensearch: serverless cluster. Default value: N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| eip | Yes | CreateClusterPublicEip object | Definition: Public network bandwidth. Constraints: N/A Value range: N/A Default value: N/A |
| elbWhiteListReq | No | CreateClusterElbWhiteList object | Definition: Whitelist for public network access control. Constraints: N/A Value range: N/A Default value: N/A |
| publicBindType | Yes | String | Definition: Whether to automatically bind an EIP. Constraints: N/A Value range: Currently, only auto_assign is supported. Default value: N/A |
| eipId | No | String | Definition: EIP ID. Constraints: N/A Value range: N/A Default value: N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| bandWidth | Yes | CreateClusterPublicEipSize object | Definition: Set the public network bandwidth. Constraints: N/A Value range: N/A Default value: N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| size | Yes | Integer | Definition: Bandwidth size, in Mbit/s. Constraints: N/A Value range: 1-200 Default value: 1 |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| eipSize | Yes | Integer | Definition: Bandwidth size, in Mbit/s. Constraints: N/A Value range: 1-200 Default value: 1 |
| elbWhiteList | No | Definition: Public network access whitelist for Kibana/Dashboards. Constraints: N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| systemEncrypted | No | String | Definition: Whether disk encryption is enabled. KMS is used to encrypt the data disks of cluster nodes to ensure the security of stored data. Constraints: Disk encryption and decryption do not alter cluster management or O&M processes. However, they do increase the system's processing load, potentially affecting the system's operational performance. Value range: Default value: 0 |
| systemCmkid | No | String | Definition: Disk key ID. Constraints: This parameter is valid only when systemEncrypted is set to 1. Select a KMS key from the drop-down list. KMS keys that are unavailable in this drop-down list are not supported by the cluster. Set a key that meets the following requirements: After cluster creation, the KMS key cannot be changed. If the KMS key used by the cluster is disabled, the cluster cannot be scaled or upgraded, its node specifications or AZs cannot be changed, and its nodes cannot be replaced (by specifying the nodes that need replacement). To solve this problem, you will have to create a new cluster and migrate your data to that new cluster. Value range: N/A Default value: N/A |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| cluster | CreateClusterResp object | Definition: Cluster object. For a pay-per-use cluster, only the cluster parameter is returned. Value range: N/A. |
| orderId | String | Definition: Order ID. This parameter is returned only when a yearly/monthly cluster is created. Value range: N/A. |
Example Requests
-
Example request for creating a yearly/monthly Elasticsearch cluster.
POST https://{Endpoint}/v2.0/{project_id}/clusters { "cluster" : { "name" : "css-cluster", "desc" : "Cluster Testing", "backupStrategy" : { "period" : "16:00 GMT+08:00", "prefix" : "snapshot", "keepday" : 7, "frequency" : "DAY", "bucket" : "OBS-obsName", "basePath" : "css_repository/obs-path", "agency" : "css_obs_agency", "maxSnapshotBytesPerSeconds" : 40, "maxRestoreBytesPerSeconds" : 40 }, "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" : null } } } -
Example request for creating a pay-per-use Elasticsearch cluster
POST https://{Endpoint}/v2.0/{project_id}/clusters { "cluster" : { "name" : "css-cluster", "desc" : "Cluster Testing", "backupStrategy" : { "period" : "16:00 GMT+08:00", "prefix" : "snapshot", "keepday" : 7, "frequency" : "DAY", "bucket" : "OBS-obsName", "basePath" : "css_repository/obs-path", "agency" : "css_obs_agency", "maxSnapshotBytesPerSeconds" : 40, "maxRestoreBytesPerSeconds" : 40 }, "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 } } } }
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", "cluster" : { "id" : "ef683016-871e-48bc-bf93-74a29d60d214", "name" : "ES-Test" } }
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.
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