Add existing Elastic Compute Service (ECS) instances to a cluster.

Note
The system disk is replaced in the process of adding ECS instances. Therefore, back up the data in advance.

Request information

Request line (RequestLine)

POST /clusters/{cluster_id}/attach HTTP/1.1

Request line parameter (URI Param)

Name Type Required Description
cluster_id string Yes Cluster ID

Special request header (RequestHead)

None. See Public request headers.

Request body (RequestBody)

{
    "password": "password of the root account to log on to the ECS instance",
    "instances": "the instance array to be added",
    "ecs_image_id": "operating system image",
    "release_eip_flag": "whether to release Elastic IP (EIP) after configuring the cluster"
}

Request body explanation

Name Type Required Description
password string Yes The password of the ECS instance.
instances array Yes The array of existing ECS instances.
ecs_image_id string Yes The ID of the system image used by ECS.
release_eip_flag bool No Whether to release EIP after configuring the cluster. The default value is false.

ecs_image_id list

See View image list to obtain 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 version is equal to or later than 3.18, 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 OK
{
    "list": [
        {
            "code": "200",
            "instanceId": "i-xxx",
            "message": "successful"
        },
        {
            "code": "200",
            "instanceId": "i-yyy",
            "message": "successful"
        }
    ],
    "task_id": "T-5a544aff80282e39ea000039"
}

Special response header (ResponseHead)

None. See Public response headers.

Response body

{
    "list": [
        {
            "code": "200",
            "instanceId": "i-2zee3oiwcyoz7kwdo8bt",
            "message": "successful"
        },
        {
            "code": "200",
            "instanceId": "i-2ze0lgm3y6iylcbtcypf",
            "message": "successful"
        }
    ],
    "task_id": "T-5a544aff80282e39ea000039"
}

Example

Sample request

POST /clusters/Cccfd68c474454665ace07efce924f75f/attach HTTP/1.1
<Public request headers>

Response example

HTTP/1.1 202 Accepted
<Public response header>
{
    "list": [
        {
            "code": "200",
            "instanceId": "i-2zee3oiwcyoz7kwdo8bt",
            "message": "successful"
        },
        {
            "code": "200",
            "instanceId": "i-2ze0lgm3y6iylcbtcypf",
            "message": "successful"
        }
    ],
    "task_id": "T-5a544aff80282e39ea000039"
}