All Products
Search
Document Center

Server Load Balancer:SetBackendServers

Last Updated:Mar 14, 2024

Sets weights for backend servers.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
slb:SetBackendServersWRITE
  • instance
    acs:ecs:{#regionId}:{#accountId}:instance/{#instanceId}
  • loadbalancer
    acs:slb:{#regionId}:{#accountId}:loadbalancer/{#loadbalancerId}
  • ecs:tag
  • slb:tag
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringNo

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

cn-hangzhou
LoadBalancerIdstringYes

The ID of the CLB instance.

lb-bp1qjwo61pqz3a******
BackendServersstringNo

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. 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 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 only for high-performance CLB 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 must be in the Running state. You can specify up to 20 backend servers in each request.
[{ "ServerId": "ecs-******FmYAXG", "Weight": "100", "Type": "ecs", "Port":"80","Description":"test-112" }]

Response parameters

ParameterTypeDescriptionExample
object
LoadBalancerIdstring

The ID of the CLB instance.

lb-bp1qjwo61pqz3a******
RequestIdstring

The ID of the request.

365F4154-92F6-4AE4-92F8-7FF34B540710
BackendServersobject []

The list of backend servers.

Typestring

The type of the backend server. Valid values:

  • ecs (default): an ECS instance
  • eni: an elastic network interface (ENI)
eni
Weightstring

The weight of the backend server.

100
Descriptionstring

The description of the backend server.

backend server
ServerIdstring

The ID of the server.

eni-hhshhs****

Examples

Sample success responses

JSONformat

{
  "LoadBalancerId": "lb-bp1qjwo61pqz3a******",
  "RequestId": "365F4154-92F6-4AE4-92F8-7FF34B540710",
  "BackendServers": {
    "BackendServer": [
      {
        "Type": "eni",
        "Weight": "100",
        "Description": "backend server",
        "ServerId": "eni-hhshhs****"
      }
    ]
  }
}

Error codes

HTTP status codeError codeError message
400Mismatched.ZoneIdThe zone of the server is not matched with the cloud box loadbalancer.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-12-13The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400