Sets the weights of backend servers.

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 SetBackendServers

The operation that you want to perform.

Set the value to SetBackendServers.

LoadBalancerId String Yes lb-bp1qjwo61pqz3a******

The ID of the Server Load Balancer (SLB) instance.

RegionId String Yes cn-hangzhou

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

BackendServers String Yes [{ "ServerId": "ecs-******FmYAXG", "Weight": "100", "Type": "ecs", "Port":"80","Description":"test-112" }]

The list of backend servers that you want to add to the SLB instance.

The value of this parameter must be a STRING list in the JSON format. You can specify up to 20 elements in each request.

  • ServerId: Required. Specify the ID of the backend server. This parameter must be of the STRING type.
  • Port: The port number that is used by the backend server. This parameter must be of the INTEGER type. Valid values: 1 to 65535.
  • Weight: The weight of the backend server. This parameter must be of the INTEGER type. Valid values: 0 to 100.
  • Description: Optional. Specify a description for the backend server. This parameter must be of the STRING type. 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. This parameter must be of the STRING type. Valid values:
    • ecs (default): an Elastic Compute Service (ECS) instance
    • eni: an Elastic Network Interface (ENI) You can specify ENIs as the backend servers of only high-performance SLB instances.
  • ServerIp: The IP address of the ECS instance or ENI.

Examples:

  • ECS instance: [{ "ServerId": "ecs-******FmYAXG", "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 an SLB instance must be in the Running state. You can add up to 20 backend servers to an SLB instance in each request.

Response parameters

Parameter Type Example Description
LoadBalancerId String lb-bp1qjwo61pqz3a******

The ID of the SLB instance.

BackendServers Array of BackendServer

The list of backend servers.

BackendServer
ServerId String eni-hhshhs****

The ID of the backend server.

Weight String 100

The weight of the backend server.

Description String BackendServer

The description of the backend server.

Type String eni

The type of backend server. Valid values:

  • ecs (default): an ECS instance
  • eni: an ENI
RequestId String 365F4154-92F6-4AE4-92F8-7FF34B540710

The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/?Action=SetBackendServers
&LoadBalancerId=lb-bp1qjwo61pqz3a******
&BackendServers=[{ "ServerId": "i-xxxxxxxxx", "Weight": "100", "Type": "ecs",  "Port":"80","Description":"test-112" }]
&<Common request parameters>

Sample success responses

XML format

<SetBackendServersResponse>
      <RequestId>365F4154-92F6-4AE4-92F8-7FF34B540710</RequestId>
      <LoadBalancerId>lb-dhf13*******</LoadBalancerId>
      <BackendServers>
            <BackendServer>
                  <ServerId>eni-hg231**</ServerId>
                  <Weight>100</Weight>
                              <Type>eni</Type>
            </BackendServer>
            <BackendServer>
                  <ServerId>eni-hfhf***</ServerId>
                  <Weight>100</Weight>
                              <Type>eni</Type>
            </BackendServer>
      </BackendServers>
</SetBackendServersResponse>

JSON format

{
    "RequestId": "365F4154-92F6-4AE4-92F8-7FF34B540710",
    "LoadBalancerId": "139a00604ad-cn-ea******",
    "BackendServers": {
      "BackendServer": [
        {
          "ServerId": "eni-hg231**",
          "Weight": "100",
          "Type": "eni"
        },
        {
          "ServerId": "eni-hhshhs****",
          "Weight": "100",
          "Type": "eni"
        }
      ]
    }
  }

Error codes

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