Modify Weights of Back-end Servers

Last updated: 2019-11-29 19:04:41

API Description

This API (ModifyLoadBalancerBackends) is used to modify the weight of CVMs bound to a load balancer instance. You can adjust request forwarding rules by modifying weight of CVMs.

Domain name for API access: lb.api.qcloud.com

Request Parameters

The following request parameter list only provides the API request parameters. Common request parameters are required when the API is called. The Action field for this API is ModifyLoadBalancerBackends.

Parameter Name Required Type Description
loadBalancerId Yes String ID of the load balancer instance, which can be queried via the API DescribeLoadBalancers.
backends.n.instanceId Yes String Unique ID of the CVM, which can be obtained from "unInstanceId" in the returned fields of API DescribeInstances.
This API allows entering instance IDs of multiple CVMs at a time. For example, if you want to enter two CVMs, enter: backends.0.instanceId&backends.1.instanceId.
backends.n.weight Yes Int Weight of the bound CVM. Value range is 0-100. Default is 10.

Response Parameters

Parameter Name Type Description
code Int Common error code; 0: Successful; other values: Failed.
message String Module error message description depending on API.
codeDesc String Error code. For a successful operation, "Success" is returned. For a failed operation, a message describing the failure is returned.
requestId Int Request task ID. The API is an asynchronous task. DescribeLoadBalancersTaskResult is used to query the result of task execution.

Example

Request

https://lb.api.qcloud.com/v2/index.php?Action=ModifyLoadBalancerBackends
&<Common request parameters>
&loadBalancerId=lb-abcdefgh
&backends.0.instanceId=ins-6789test
&backends.0.weight=10
&backends.1.instanceId=ins-1234test
&backends.1.weight=6

Response


{
  "code" : 0,
  "message" : "",
  "codeDesc": "Success",
  "requestId" : 1234
}