Adds existing Elastic Compute Service (ECS) instances to a specified Container Service for Kubernetes (ACK) 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 syntax

POST /clusters/ClusterId/attach HTTP/1.1 
  "instances" : [ "String" ],
  "key_pair" : "String",
  "password" : "String",
  "format_disk" : Boolean,
  "keep_instance_name" : Boolean,
  "is_edge_worker" : Boolean,
  "nodepool_id" : "String",
  "image_id" : "String",
  "cpu_policy" : "String",
  "user_data" : "String",
  "rds_instances" : [ "String" ],
  "runtime" : {
    "name" : "String",
    "version" : "String"
  "tags" : [ {
    "key" : "String",
    "value" : "String"
  } ]

Request parameters

Table 1. Request path parameters
Parameter Type Required Example Description
ClusterId String Yes c106f377e16f34eb1808d6b9362c9****

The ID of the ACK cluster that you want to manage.

Table 2. Request body parameters
Parameter Type Required Example Description
instances Array of String Yes i-2zed0sswuau6o89b****

The IDs of the existing ECS instances that you want to add.

key_pair String Yes secrity-key

The name of the key pair that is used to log on to the ECS instances. You must set key_pair or login_password.

password String Yes Hello1234

The SSH logon password that is used to log on to the ECS instances. You must set login_password or key_pair. The password must be 8 to 30 characters in length, and must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. It cannot contain backward slashes (\) or double quotation marks (").

For security considerations, the password is encrypted during data transfer.

format_disk Boolean No false

Specifies whether to store container data and images on data disks. Valid values:

  • true: mounts data disks to store container data and images.
  • false: does not mount data disks to store container data or images.

Default value: false.

A data disk is mounted based on the following rules:

  • If the ECS instances are already mounted with data disks and the file system of the last data disk is not initialized, the system automatically formats this data disk to ext4 and mounts it to /var/lib/docker and /var/lib/kubelet.
  • If no data disk is mounted to the ECS instances, the system does not purchase a new data disk.
    Note If you choose to store container data and images on data disks and a data disk is already mounted to the ECS instance, the original data on this data disk will be cleared. You can back up the disk to avoid data loss.
keep_instance_name Boolean No true

Specifies whether to keep the instance name. Valid values:

  • true: keeps the instance name.
  • false: does not keep the instance name.

Default value: true.

is_edge_worker Boolean No false

Specifies whether the nodes that you want to add are Edge Node Service (ENS) nodes. Valid values:

  • true: The nodes that you want to add are ENS nodes.
  • false: The nodes that you want to add are not ENS nodes.

Default value: false.

Note If the nodes you want to add are ENS nodes, you must set this parameter to true. This allows you to identify these nodes.
nodepool_id String No np615c0e0966124216a0412e10afe0****

The ID of the node pool to which the nodes are added. If you do not set this parameter, the nodes are added to a default node pool.

image_id String No aliyun_2_1903_x64_20G_alibase_20200529.vhd

The ID of the custom image. If you do not set this parameter, the default system image is used.

Note If you specify a custom image, the custom image is used to deploy the operating systems on the system disks of the nodes.
cpu_policy String No none

The CPU policy. The following policies are supported for clusters of Kubernetes 1.12.6 and later:

  • static: This policy allows pods with specific resource characteristics on the node to be granted enhanced CPU affinity and exclusivity.
  • none: This policy indicates that the default CPU affinity is used. This is the default policy.

Default value: none.

user_data String No IyEvdXNyL2Jpbi9iYXNoCmVjaG8gIkhlbGxvIEFDSyEi

The user-defined data. For more information, see Prepare user-defined data.

rds_instances Array of String No rm-67yawhau****

The IDs of the ApsaraDB RDS instances.

runtime runtime No

The name of the container runtime.

tags Array of tag No

The labels of the nodes. You must add labels based on the following rules:

  • A label is a case-sensitive key-value pair. You can add up to 20 labels to a node.
  • A key must be unique and 1 to 64 characters in length. A value can be empty and can contain up to 128 characters. Neither keys nor values can start with aliyun, acs:, https://, or http://. For more information, see Labels and Selectors.

Response syntax

HTTP/1.1 200
  "list" : [ {
    "code" : "String",
    "instanceId" : "String",
    "message" : "String"
  } ],
  "task_id" : "String"

Response parameters

Table 3. Response body parameters
Parameter Type Example Description
list Array of list

The details of the added nodes.

code String 200

The code that indicates the task result.

instanceId String i-2ze0lgm3y6iylcbt****

The IDs of the added ECS instances.

message String successful

Indicates whether the ECS instances are successfully added to the ACK cluster.

task_id String T-5a544aff80282e39ea000039

The ID of the scaling task.


Sample requests

POST /clusters/c106f377e16f34eb1808d6b9362c9****/attach HTTP/1.1 
  "instances" : [ "i-2zed0sswuau6o89b****" ],
  "key_pair" : "secrity-key",
  "password" : "Hello1234",
  "format_disk" : false,
  "keep_instance_name" : true,
  "is_edge_worker" : false,
  "nodepool_id" : "np615c0e0966124216a0412e10afe0****",
  "image_id" : "aliyun_2_1903_x64_20G_alibase_20200529.vhd",
  "cpu_policy" : "none",
  "user_data" : "IyEvdXNyL2Jpbi9iYXNoCmVjaG8gIkhlbGxvIEFDSyEi",
  "rds_instances" : [ "rm-67yawhau****" ],
  "runtime" : {
    "name" : "docker",
    "version" : "19.03.5"
  "tags" : [ {
    "key" : "env",
    "value" : "prod"
  } ]

Sample success responses

XML format

HTTP/1.1 200 OK


JSON format

HTTP/1.1 200 OK

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

Error codes

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