Add existing ECS instances

Updated at:

Attaches existing Elastic Compute Service (ECS) instances to an ACK cluster.

For the full API reference, see Add existing instances to a node pool.

Request syntax

aliyun cs POST /clusters/<YOUR-CLUSTER-ID>/attach --header "Content-Type=application/json" --body "$(cat attach.json)"

Request parameters

CLI parameters

Parameter Description
--header The request header. Set Content-Type to application/json.
--body The request body as a JSON file. Save the content to a local file (for example, attach.json) and pass it using $(cat attach.json).

Request body

Parameter Description
instances The IDs of the ECS instances to add to the cluster.
password The password of the ECS instances.
key_pair The key pair used to authenticate to the ECS instances.
format_disk Specifies whether to format data disks on the ECS instances.
tags The tags to add to the nodes. Specify as an array.

Example: `attach.json`

{
    "instances": "<YOUR-INSTANCE-IDS>",
    "password": "<YOUR-INSTANCE-PASSWORD>",
    "key_pair": "<YOUR-KEY-PAIR-NAME>",
    "format_disk": "<true|false>",
    "tags": []
}

Response elements

Field Description
list The results for each ECS instance attachment. Each item contains code, instanceId, and message.
list.code The status code for the attachment result. 200 indicates success.
list.instanceId The ID of the ECS instance.
list.message The result message for the attachment operation.
task_id The ID of the task created for this operation.

Examples

Sample request

aliyun cs POST /clusters/<YOUR-CLUSTER-ID>/attach --header "Content-Type=application/json" --body "$(cat attach.json)"

Sample response

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