Adds backend servers to a specified server group.

Debugging

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 parameters

Parameter Type Required Example Description
Action String Yes AddServersToServerGroup

The operation that you want to perform. Set the value to AddServersToServerGroup.

ServerGroupId String Yes sgp-atstuj3rtoptyui****

The server group ID.

Servers.N.ServerId String Yes ecs-bp67acfmxazb4p****

The backend server ID. You can specify up to 40 backend servers in each call.

  • If the server group type is Instance, set this parameter to the ID of an Elastic Compute Service (ECS) instance, an elastic network interface (ENI), or an elastic container instance. The backend servers are specified by Ecs, Eni, or Eci.
  • If the server group type is Ip, set this parameter to an IP address.
Servers.N.ServerType String Yes Ecs

The type of the backend server. Valid values:

  • Ecs: ECS instance
  • Eni: ENI
  • Eci: elastic container instance
  • Ip: IP address
Note You can specify up to 40 backend servers in each call.
Servers.N.ServerIp String No 192.168.6.6

The IP address of the backend server. If the server group type is Ip, you must specify an IP address.

Note You can specify up to 40 backend servers in each call.
Servers.N.Port Integer No 443

The port that is used by the backend server. Valid values: 1 to 65535.

After all-port forwarding is enabled for a server group, you do not need to specify ports when you add backend servers. NLB forwards traffic to backend servers based on the frontend ports. You can query whether all-port forwarding is enabled for a server group based on AnyPortEnabled returned for the ListServerGroups operation.

Note You can specify up to 40 backend servers in each call.
Servers.N.Weight Integer No 100

The weight of the backend server. Valid values: 0 to 100. Default value: 100. If the weight of a backend server is set to 0, no requests are forwarded to the backend server.

Note You can specify up to 40 backend servers in each call.
Servers.N.Description String No ECS

The description of the backend server.

The description must be 2 to 256 characters in length, and can contain letters, digits, commas (,), periods (.), semicolons (;), forward slashes (/), at signs (@), underscores (_), and hyphens (-).

Note You can specify up to 40 backend servers in each call.
RegionId String No cn-hangzhou

The region ID of the NLB instance.

You can call the DescribeRegions operation to query the most recent region list.

DryRun Boolean No false

Specifies whether to perform only a dry run, without performing the actual request. Valid values:

  • true: performs only a dry run. The system checks the request for potential issues, including missing parameter values, incorrect request syntax, and service limits. If the request fails the dry run, an error message is returned. If the request passes the dry run, the DryRunOperation error code is returned.
  • false (default): performs a dry run and performs the actual request. If the request passes the dry run, a 2xx HTTP status code is returned and the operation is performed.
ClientToken String No 123e4567-e89b-12d3-a456-426655440000

The client token that is used to ensure the idempotence of the request.

You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters.

Note If you do not specify this parameter, the system automatically uses the client token as the request ID. The request ID may be different for each request.

Response parameters

Parameter Type Example Description
RequestId String 54B48E3D-DF70-471B-AA93-08E683A1B45

The request ID.

ServerGroupId String sgp-atstuj3rtoptyui****

The server group ID.

JobId String 72dcd26b-f12d-4c27-b3af-18f6aed5****

The ID of the asynchronous task.

Examples

Sample requests

http(s)://[Endpoint]/?Action=AddServersToServerGroup
&ServerGroupId=sgp-atstuj3rtoptyui****
&Servers=[{"ServerId":"ecs-bp67acfmxazb4p****","ServerType":"Ecs","ServerIp":"192.168.6.6","Port":443,"Weight":100,"Description":"ECS"}]
&RegionId=cn-hangzhou
&DryRun=false
&ClientToken=123e4567-e89b-12d3-a456-426655440000
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<AddServersToServerGroupResponse>
    <RequestId>54B48E3D-DF70-471B-AA93-08E683A1B45</RequestId>
    <ServerGroupId>sgp-atstuj3rtoptyui****</ServerGroupId>
    <JobId>72dcd26b-f12d-4c27-b3af-18f6aed5****</JobId>
</AddServersToServerGroupResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "54B48E3D-DF70-471B-AA93-08E683A1B45",
  "ServerGroupId" : "sgp-atstuj3rtoptyui****",
  "JobId" : "72dcd26b-f12d-4c27-b3af-18f6aed5****"
}

Error codes

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