Modifies the configurations of a server group of Network Load Balancer (NLB).

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 UpdateServerGroupAttribute

The operation that you want to perform. Set the value to UpdateServerGroupAttribute.

ServerGroupId String Yes sgp-atstuj3rtoptyui****

The ID of the server group.

ServerGroupName String No NLB_ServerGroup1

The new name of the server group.

The name must be 2 to 128 characters in length and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter.

ConnectionDrainEnabled Boolean No false

Specifies whether to enable connection draining. Valid values:

  • true: enables connection draining.
  • false: disables connection draining.
ConnectionDrainTimeout Integer No 10

The timeout period of connection draining. Unit: seconds. Valid values: 10 to 900.

Scheduler String No Wrr

The scheduling algorithm. Valid values:

  • Wrr: Backend servers with higher weights receive more requests than backend servers with lower weights.
  • rr: Requests are forwarded to backend servers in sequence.
  • sch: Requests from the same source IP address are forwarded to the same backend server.
  • tch: Four-element hashing is used. This value specifies consistent hashing that is based on four factors: source IP address, destination IP address, source port, and destination port. Requests that contain the same information based on the four factors are forwarded to the same backend server.
  • qch: Requests that contain the same QUIC ID are forwarded to the same backend server.
PreserveClientIpEnabled Boolean No false

Specifies whether to enable client IP preservation. Valid values:

  • true: enables client IP preservation.
  • false: disables client IP preservation.
HealthCheckConfig.HealthCheckEnabled Boolean No false

Specifies whether to enable the health check feature. Valid values:

  • true: enables the health check feature.
  • false: disables the health check feature.
HealthCheckConfig.HealthCheckType String No TCP

The protocol that is used for health checks. Valid values: TCP and HTTP.

HealthCheckConfig.HealthCheckConnectPort Integer No 0

The backend port that is used for health checks. Valid values: 0 to 65535. If you set the value to 0, the ports of backend servers are used for health checks.

HealthCheckConfig.HealthyThreshold Integer No 3

The number of times that an unhealthy backend server must consecutively pass health checks before it is declared healthy. In this case, the health status is changed from fail to success. Valid values: 2 to 10.

HealthCheckConfig.UnhealthyThreshold Integer No 3

The number of times that a healthy backend server must consecutively fail health checks before it is declared unhealthy. In this case, the health status is changed from success to fail. Valid values: 2 to 10.

HealthCheckConfig.HealthCheckConnectTimeout Integer No 100

The maximum timeout period of a health check response. Unit: seconds. Valid values: 1 to 300.

HealthCheckConfig.HealthCheckInterval Integer No 5

The interval between two consecutive health checks. Unit: seconds.

Valid values: 5 to 50.

HealthCheckConfig.HealthCheckDomain String No $SERVER_IP

The domain name that is used for health checks. Valid values:

  • $SERVER_IP: the private IP address of a backend server.
  • domain: a specific domain name. The domain name must be 1 to 80 characters in length and can contain lowercase letters, digits, hyphens (-), and periods (.).
Note This parameter takes effect only when you set HealthCheckType to HTTP.
HealthCheckConfig.HealthCheckUrl String No /test/index.html

The path to which health check requests are sent.

The path must be 1 to 80 characters in length, and can contain only letters, digits, and the following special characters: - / . % ? # & =. The path can also contain the following extended characters: _ ; ~ ! ( ) * [ ] @ $ ^ : ' , +. The path must start with a forward slash (/).

Note This parameter takes effect only when you set HealthCheckType to HTTP.
HealthCheckConfig.HealthCheckHttpCode.N String No http_2xx

The HTTP status codes to return for health checks. Separate multiple HTTP status codes with commas (,).

Valid values: http_2xx (default), http_3xx, http_4xx, and http_5xx.

Note This parameter takes effect only when you set HealthCheckType to HTTP.
HealthCheckConfig.HttpCheckMethod String No GET

The HTTP method that is used for health checks. Valid values: GET and HEAD.

Note This parameter takes effect only when you set HealthCheckType to HTTP.
RegionId String No cn-hangzhou

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

You can call the DescribeRegions operation to query the available regions.

DryRun Boolean No false

Specifies whether to only precheck the request. Valid values:

  • true: checks the request without performing the UpdateServerGroupAttribute operation. The system checks the required parameters, request syntax, and limits. If the request fails the check, an error message is returned. If the request passes the check, the DryRunOperation error code is returned.
  • false (default): sends the request. If the request passes the check, a 2xx HTTP status code is returned and the UpdateServerGroupAttribute operation is performed.
ClientToken String No 123e4567-e89b-12d3-a456-426655440000

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. The token can contain only ASCII characters.

Note If you do not specify this parameter, the system automatically sets ClientToken to the value of RequestId. RequestId may be different for each API request.

Response parameters

Parameter Type Example Description
RequestId String 54B48E3D-DF70-471B-AA93-08E683A1B45

The ID of the request.

ServerGroupId String sgp-atstuj3rtoptyui****

The ID of the server group.

JobId String 72dcd26b-f12d-4c27-b3af-18f6aed5****

The ID of the asynchronous task.

Examples

Sample requests

http(s)://[Endpoint]/?Action=UpdateServerGroupAttribute
&ServerGroupId=sgp-atstuj3rtoptyui****
&ServerGroupName=NLB_ServerGroup1
&ConnectionDrainEnabled=false
&ConnectionDrainTimeout=10
&Scheduler=Wrr
&PreserveClientIpEnabled=false
&HealthCheckConfig={"HealthCheckEnabled":false,"HealthCheckType":"TCP","HealthCheckConnectPort":0,"HealthyThreshold":3,"UnhealthyThreshold":3,"HealthCheckConnectTimeout":100,"HealthCheckInterval":5,"HealthCheckDomain":"$SERVER_IP","HealthCheckUrl":"/test/index.html","HealthCheckHttpCode":["http_2xx"],"HttpCheckMethod":"GET"}
&RegionId=cn-hangzhou
&DryRun=false
&ClientToken=123e4567-e89b-12d3-a456-426655440000
Common request parameters

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<UpdateServerGroupAttributeResponse>
    <RequestId>54B48E3D-DF70-471B-AA93-08E683A1B45</RequestId>
    <ServerGroupId>sgp-atstuj3rtoptyui****</ServerGroupId>
    <JobId>72dcd26b-f12d-4c27-b3af-18f6aed5****</JobId>
</UpdateServerGroupAttributeResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "54B48E3D-DF70-471B-AA93-08E683A1B45",
  "ServerGroupId" : "sgp-atstuj3rtoptyui****",
  "JobId" : "72dcd26b-f12d-4c27-b3af-18f6aed5****"
}

Error codes

For a list of error codes, see Service error codes.