Adds backend servers.

Note If multiple identical Elastic Compute Service (ECS) instances are specified in a request, only the first ECS instance is added. The other ECS instances are ignored. If the backend server that you add is the same as one of the existing backend servers that are already associated with the listener, an error message is returned.

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 AddBackendServers

The operation that you want to perform.

Set the value to AddBackendServers.

LoadBalancerId String Yes lb-2ze7o5h52g02kkzz******

The ID of the Classic Load Balancer (CLB) instance.

RegionId String Yes cn-beijing

The ID of the region where the CLB instance is deployed.

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

BackendServers String Yes [{ "ServerId": "eni-xxxxxxxxx", "Weight": "100", "Type": "eni", "ServerIp": "192.168.**.**", "Port":"80","Description":"test-112" },{ "ServerId": "eni-xxxxxxxxx", "Weight": "100", "Type": "eni", "ServerIp": "172.166.**.**", "Port":"80","Description":"test-113" }]

The list of backend servers that you want to add. Set the following parameters:

  • ServerId: This parameter is required and the value must be a string. Enter the ID of an Elastic Compute Service (ECS) instance or elastic network interface (ENI). If ServerId is set to the ID of an ENI, Type is required.
  • Weight: The weight of the backend server. Valid values: 0 to 100. Default value: 100.

    If the value is set to 0, no requests are forwarded to the backend server.

  • Description: Optional. The description of the backend server. This value must be a string. The description must be 1 to 80 characters in length, and can contain letters, digits, hyphens (-), forward slashes (/), periods (.), and underscores (_).
  • Type: The type of the backend server. Valid values:
    • ecs: an ECS instance. This is the default value.
    • eni: an ENI.
Note You can specify ENIs as the backend servers only for high-performance CLB instances.
  • ServerIp: the IP address of the ECS instance or ENI.

Examples:

  • ECS instance: [{ "ServerId": "i-xxxxxxxxx", "Weight": "100", "Type": "ecs", "Port": "80", "Description": "test-112" }].
  • ENI: [{ "ServerId": "eni-xxxxxxxxx", "Weight": "100", "Type": "eni", "ServerIp": "192.168.**.**", "Port":"80","Description":"test-112" }]
  • ENI with multiple IP addresses: [{ "ServerId": "eni-xxxxxxxxx", "Weight": "100", "Type": "eni", "ServerIp": "192.168.**.**", "Port":"80","Description":"test-112" },{ "ServerId": "eni-xxxxxxxxx", "Weight": "100", "Type": "eni", "ServerIp": "172.166.**.**", "Port":"80","Description":"test-113" }]
Note The backend servers that you add to a CLB instance must be in the Running state. You can add at most 20 backend servers to a CLB instance in each request.

Response parameters

Parameter Type Example Description
LoadBalancerId String lb-2ze7o5h52g02kkzz****

The ID of the CLB instance.

BackendServers Array of BackendServer

The list of backend servers.

BackendServer
ServerId String i-2zej4lxhjoq1icu*****

The ID of the ECS instance or ENI.

Weight String 100

The weight of the backend server.

Valid values: 0 to 100.

Default value: 100. If the value is set to 0, the CLB instance does not forward requests to the backend server.

Description String BackendServer

The description of the backend server.

Type String ecs

The type of the backend server.

  • ecs: an ECS instance. This is the default value.
  • eni: an ENI.
RequestId String 34B82C81-F13B-4EEB-99F6-A048C67CC830

The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/?Action=AddBackendServers
&RegionId=cn-hangzhou
&LoadBalancerId=lb-2ze7o5h52g02kkzz******
&BackendServers=[{ "ServerId": "eni-xxxxxxxxx", "Weight": "100", "Type": "eni", "ServerIp": "192.168.**.**", "Port":"80","Description":"test-112" },{ "ServerId": "eni-xxxxxxxxx", "Weight": "100", "Type": "eni", "ServerIp": "172.166.**.**", "Port":"80","Description":"test-113" }]
&<Common request parameters>

Sample success responses

XML format

<AddBackendServersResponse>
    <BackendServers>
        <BackendServer>
            <ServerId>i-2zej4lxhjoq1icu*****</ServerId>
            <Weight>100</Weight>
            <Type>ecs</Type>
        </BackendServer>
        <BackendServer>
            <ServerId>i-2ze1u9ywulp5pbv*****</ServerId>
            <Weight>100</Weight>
            <Type>ecs</Type>
        </BackendServer>
    </BackendServers>
    <RequestId>34B82C81-F13B-4EEB-99F6-A048C67CC830</RequestId>
    <LoadBalancerId>lb-2ze7o5h52g02kkzz*****</LoadBalancerId>
</AddBackendServersResponse>

JSON format

{
    "RequestId": "34B82C81-F13B-4EEB-99F6-A048C67CC830",
    "BackendServers": {
        "BackendServer": [
            {
                "ServerId": "i-2zej4lxhjoq1icue****",
                "Weight": 100,
                "Type": "ecs"
            },
            {
                "ServerId": "i-2ze1u9ywulp5pbvv****",
                "Weight": 100,
                "Type": "ecs"
            }
        ]
    },
    "LoadBalancerId": "lb-2ze7o5h52g02kkzze****"
}

Error codes

HttpCode Error code Error message Description
400 InvalidParameter The specified load balancer does not support the network type of the ECS instance. The error message returned because the CLB instance does not support ECS instances of the specified type. Specify a valid type of ECS instance and try again.

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