You can call the DescribeEdgeClusterAttachScripts operation to add an existing ECS instance to a cluster.

Note When you add an ECS instance to a cluster, the system disk of the instance is replaced. We recommend that you back up data in advance.

Request information

Request line

POST /clusters/{cluster_id}/attach HTTP/1.1
Table 1. Request parameters
Parameter Type Required Description
cluster_id string Yes The ID of the cluster that you want to add nodes to.

Custom request headers

None. For more information, see Public request headers.

Request body

{ "password": "root password of the ECS instance", "instances": "instances that you want to add to the cluster", "format_disk": "whether to format data disks", "key_pair": "key pair" "tags": "node tags in an array" }
Table 2. Request body parameters
Parameter Type Required Description
password String Yes The password for logging on to the ECS instance. The password must be 8 to 30 characters in length and contain three of the following four types of characters: uppercase letters, lowercase letters, digits, and special characters.
instances Array Yes The instances that you want to add to the cluster.
format_disk bool No Whether to format data disks.
key_pair string No
The name of the key pair.
  • For Windows instances, this parameter is ignored. Default is empty. The password parameter takes effect even if this parameter is set.
  • For Linux instances, if this parameter is set, password authentication is disabled.
tags list No The tags of the nodes.
  • key: The name of the tag.
  • value: The value of the tag.

Response information

Response line

HTTP/1.1 202 OK

Custom response headers

None. For more information, see Public response headers.

Response body

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

Examples

Sample requests

POST /clusters/Cccfd68c474454665ace07efce924****/attach HTTP/1.1
<Common request headers> {    "password": "Hello1234",
    "tags":[],
    "instances": [
        "i-xxxx",
        "i-yyyy"
    ]
}

Sample responses

HTTP/1.1 202 Accepted
<Common response headers> {
    "list": [
        {
            "code": "200",
            "instanceId": "i-xxxx",
            "message": "successful"
        },
        {
            "code": "200",
            "instanceId": "i-yyyy",
            "message": "successful"
        }
    ],
    "task_id": "T-5a544aff80282e39ea000039"
}