Create a cluster with a specified number of new nodes.

Request information

Request line (RequestLine)

POST /clusters HTTP/1.1

Request line parameter (URI Param)

None.

Special request header (RequestHead)

None. See Public request headers.

Request body (RequestBody)

{
    "password": "password of the root account to log on to the Elastic Compute Service (ECS) instance",
    "region_id": "RegionID",
    "instance_type": "ECS instance type",
    "name": "cluster name",
    "size": "number of nodes",
    "network_mode": "vpc",
    "vpc_id": "VPC_ID",
    "vswitch_id": "VSwitch ID",
    "subnet_cidr": "container Classless Inter-Domain Routing (CIDR) block such as 172.28.1.0/24",
     "data_disk_category": "disk category",
    "data_disk_size": "disk size",
    "need_slb": "whether to create Server Load Balancer instance for the cluster",
    "ecs_image_id": "operating system image",
    "io_optimized": "whether I/O to be optimized",
    "release_eip_flag": "whether to release Elastic IP (EIP) after configuring the cluster"
    "rds_instances": "RDS instance ID"
}

Request body explanation

Name Type Required Description
name  string Yes The cluster name, which can contain uppercase English letters, lowercase English letters, Chinese characters, numbers, and hyphens (-).
size integer Yes The number of ECS instances in the cluster.
instance_type string Yes The ECS instance type code.   For more information, see Instance type families.
network_mode string Yes The network mode of the cluster. Currently, only VPC is supported.
subnet_cidr string Yes The CIDR block that can be used by the cluster, for example, 192.168.24.0/22.  This field must be configured  only when the network mode is VPC.
vpc_id string Yes

The VPC ID.  This field must be configured  only when the network mode is VPC.  For more information, see VPC overview.

vswitch_id string Yes. The VSwitch ID of the VPC.  This field must be configured only when the network mode is VPC.
password  string Yes The password of the root account.
data_disk_category string Yes

The disk category used by ECS.  For more information, see  Disk category table.

data_disk_size number Yes The disk size shared by nodes.
ecs_image_id string No The ID of the system image used by ECS.  For more information, see View image list .
io_optimized string No Determined according to the ECS instance rule.  Optional values:  none or  optimized. We recommend that you pass in  optimized because currently only VPC is supported as the network mode.
need_slb bool No Whether to create the default simple routing Server Load Balancer instance for the cluster. The default value is true.
release_eip_flag bool No Whether or not to release EIP after configuring the cluster. The default value is false.
rds_instances array No Whether to add the IP address of the ECS instance to the RDS instance whitelist.

ecs_image_id list

See View image list to obtain the ecs_image_id  list.  To customize the ECS image ID of the cluster, make sure the ECS image meets the following requirements:

  • Operating system: Ubuntu or CentOS.
  • The Linux Kernel is 3.18 version or later, which is used to support overlayfs and overlay network.
  • The /etc/docker/key.json file is deleted from the image.

Response information

Response line (ResponseLine)

HTTP/1.1 202 Accepted

Special response header (ResponseHead)

None. See Public response headers.

Response body (ResponseBody)

{
    "cluster_id":"string",
    "request_id":"string",
    "task_id":"string"
}

Example 

Request example

POST /clusters HTTP/1.1
<Public request headers>
{
    "password": "TestPwd124",
    "region_id": "cn-beijing",
    "instance_type": "ecs.n1.small",
    "name": "my-test-cluster",
    "size": 1,
    "network_mode": "vpc",
    "vpc_id":"vpc-xxxx",
    "vswitch_id":"vsw-xxxx",
    "subnet_cidr":"172.28.1.0/24",
    "data_disk_category": "cloud_ssd",
    "data_disk_size": 40,
    "need_slb":true,
    "ecs_image_id":"centos_7_04_64_20G_alibase_201701015",
    "io_optimized":"true",
    "release_eip_flag":false
}

Response example

HTTP/1.1 202 Accepted
<Public response headers>
{
    "cluster_id": "cb95aa626a47740afbf6aa099b650d7ce",
    "request_id": "687C5BAA-D103-4993-884B-C35E4314A1E1",
    "task_id": "T-5a54309c80282e39ea00002f"
}