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.

ClientToken String No 5A2CFF0E-5718-45B5-9D4D-70B3FF3898

The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must ensure that it is unique among different requests. ClientToken can contain only ASCII characters and cannot exceed 64 characters in length.

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

The list of backend servers that you want to modify.

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

Examples:

  • ECS: [{ "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 must be in the Running state. You can specify up to 20 backend servers 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 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.