You can call AttachInstances to add existing Elastic Compute Service (ECS) instances to a cluster.


OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameter types

This operation uses common request parameters only. For more information, see Common parameters.

Request syntax

POST /clusters/[ClusterId]/attach HTTPS|HTTP

Request parameters

Parameter Type Required Example Description
ClusterId String Yes c106f377e16f34eb1808d6b9362c9****

The ID of the cluster.

key_pair String Yes key-***

The name of the key pair. You must set key_pair or password.

password String Yes Hello1234

The password of the worker nodes to be added. The password must be 8 to 30 characters in length and contain three of the following character types: uppercase letters, lowercase letters, digits, and special characters. You must set key_pair or password.

format_disk Boolean No false

Specifies whether to format the data disks of the ECS instances.

keep_instance_name Boolean No true

Specifies whether to retain the names of the ECS instances.

cpu_policy String No none

The CPU policy. For Kubernetes 1.12.6 and later, valid values of cpu_policy include static and none. Default value: none.

instances List<String> No ["i-0xi187lghfcy5t2d****"]

A list of the ECS instances.

tags Array No []

The tags of the ECS instances.

Response parameters

Parameter Type Example Description
list Array

The details of the ECS instance.

code String 200

The returned status code.

instanceId String i-2zee3oiwcyoz7kwd****

The ID of the ECS instance.

message String successful

Indicates whether the ECS instance is added to the cluster.

task_id String T-5a544aff80282e39ea000039

The ID of the task.


Sample requests

POST /clusters/[ClusterId]/attach HTTP/1.1
Common request parameters
    "ClusterId": "Cccfd68c474454665ace07efce924****",  
    "password": "Hello1234",
    "format_disk": false,
    "keep_instance_name": true,
    "instances": ["i-xxxx","i-yyyy"]

Sample success responses

XML format


JSON format

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

Error codes

For a list of error codes, visit the API Error Center.