Modifies the configuration of a server group, such as the health checks, session persistence, name, scheduling algorithm, and protocols.

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.

ServerGroupName String No test

The 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.

Scheduler String No Wrr

The scheduling algorithm. Valid values:

  • Wrr: Backend servers that have higher weights receive more requests than those that have lower weights.
  • Wlc: Requests are distributed based on the weight and load of each backend server. The load refers to the number of connections to a backend server. If multiple backend servers have the same weight, requests are routed to the backend server with the least connections.
  • Sch: specifies consistent hashing that is based on source IP addresses. Requests from the same source IP address are distributed to the same backend server.
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 make sure that it is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length.

Note If you do not specify this parameter, the system automatically uses the request ID as the client token. The ID of each request is unique.
DryRun Boolean No true

Specifies whether only to precheck the request. Valid values:

  • true: only prechecks the request and does not perform the requested operation. The system checks the required parameters, request format, and service limits. If the request fails the precheck, an error code is returned based on the cause of the failure. If the request passes the precheck, the DryRunOperation error code is returned.
  • false: prechecks the request and performs the requested operation. After the request passes the precheck, an HTTP 2xx status code is returned and the system performs the operation. This is the default value.
HealthCheckConfig Object No

The configuration of health checks.

HealthCheckConnectPort Integer No 80

The backend port that is used for health checks.

Valid values: 0 to 65535.

A value of 0 indicates that the port on a backend server is used for health checks.

Note This parameter takes effect if the HealthCheckEnabled parameter is set to true for the server group.
HealthCheckEnabled Boolean No true

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

  • true: enables the feature.
  • false: disables the feature.
HealthCheckHost String No www.test.com

The domain name that is used for health checks. The domain name must meet the following requirements:

  • The domain name must be 1 to 80 characters in length.
  • The domain name can contain lowercase letters, digits, hyphens (-), and periods (.).
  • The domain name must contain at least one period (.),and cannot start or end with a period (.).
  • The rightmost field can contain only letters, and cannot contain digits or hyphens (-).
  • Other fields cannot start or end with a hyphen (-).
Note This parameter takes effect if the HealthCheckEnabled parameter is set to true and the HealthCheckProtocol parameter is set to HTTP for the server group.
HealthCheckCodes Array of String No 200

The HTTP status code that indicates a successful health check. Multiple HTTP status codes can be specified as a list.

Valid values: http_2xx, http_3xx, http_4xx, and http_5xx.

Note This parameter takes effect if the HealthCheckEnabled parameter is set to true and the HealthCheckProtocol parameter is set to HTTP for the server group.
HealthCheckHttpVersion String No HTTP1.1

The version of the HTTP protocol. Valid values: HTTP1.0 and HTTP1.1.

Note This parameter takes effect if the HealthCheckEnabled parameter is set to true and the HealthCheckProtocol parameter is set to HTTP for the server group.
HealthCheckInterval Integer No 5

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

  • Valid values: 1 to 50.
Note This parameter takes effect if the HealthCheckEnabled parameter is set to true for the server group.
HealthCheckMethod String No HEAD

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

Note This parameter takes effect if the HealthCheckEnabled parameter is set to true and the HealthCheckProtocol parameter is set to HTTP for the server group.
HealthCheckPath String No /test/index.html

The URL that is used for health checks.

The URL must be 1 to 80 characters in length, and can contain letters, digits, and the following special characters:

- / .% ?# & =.

It can also contain the following extended characters:

_ ; ~ ! ( )* [ ] @ $ ^ : ' , +.

The URL must start with a forward slash (/).

Note This parameter takes effect if the HealthCheckEnabled parameter is set to true and the HealthCheckProtocol parameter is set to HTTP for the server group.
HealthCheckProtocol String No HTTP

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

HealthCheckTimeout Integer No 3

The timeout period of a health check. If a backend server does not respond within the specified timeout period, the backend server fails the health check. Unit: seconds.

Valid values: 1 to 300.

Note If the value of the HealthCheckTimeout parameter is smaller than that of the HealthCheckInterval parameter, the timeout period specified by the HealthCheckTimeout parameter is ignored and the period of time specified by the HealthCheckInterval parameter is used as the timeout period.
Note This parameter takes effect if the HealthCheckEnabled parameter is set to true for the server group.
HealthyThreshold Integer No 4

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

Valid values: 2 to 10.

UnhealthyThreshold Integer No 4

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

Valid values: 2 to 10.

StickySessionConfig Object No

The configuration of session persistence.

Cookie String No B490B5EBF6F3CD402E515D22BCDA1598

The cookie to be configured on the backend server.

The cookie must be 1 to 200 characters in length, and can contain ASCII characters and digits. It cannot contain commas (,), semicolons (;), or spaces. It cannot start with a dollar sign ($).

Note This parameter takes effect if the StickySessionEnabled parameter is set to true and the StickySessionType parameter is set to Server for the server group.
CookieTimeout Integer No 1000

The timeout period of the cookie. Unit: seconds.

Valid values: 1 to 86400.

Note This parameter takes effect if the StickySessionEnabled parameter is set to true and the StickySessionType parameter is set to Insert for the server group.
StickySessionEnabled Boolean No true

Specifies whether to enable session persistence. Valid values: true and false.

StickySessionType String No Insert

The method that is used to handle a cookie. Valid values:

  • Insert: inserts a cookie.

    Application Load Balancer (ALB) inserts the server ID as a cookie into the first HTTP or HTTPS response that is sent to a client. The next request from the client will contain this cookie, and the listener will distribute this request to the recorded backend server.

  • Server: rewrites a cookie.

    When ALB detects a user-defined cookie, it uses the user-defined cookie to rewrite the original cookie. The next request from the client will contain the user-defined cookie, and the listener will distribute this request to the recorded backend server.

Note This parameter takes effect if the StickySessionEnabled parameter is set to true for the server group.
ServerGroupId String Yes sgp-atstuj3rtop****

The ID of the server group.

Response parameters

Parameter Type Example Description
JobId String 72dcd26b-f12d-4c27-b3af-18f6aed5****

The ID of the asynchronous task.

RequestId String 365F4154-92F6-4AE4-92F8-7FF34B540710

The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/?Action=UpdateServerGroupAttribute
&ServerGroupName=test
&Scheduler=Wrr
&ClientToken=5A2CFF0E-5718-45B5-9D4D-70B3FF3898
&DryRun=true
&HealthCheckConfig={"HealthCheckConnectPort":80,"HealthCheckEnabled":true,"HealthCheckHost":"www.test.com","HealthCheckCodes":["200"],"HealthCheckHttpVersion":"HTTP1.1","HealthCheckInterval":5,"HealthCheckMethod":"HEAD","HealthCheckPath":"/test/index.html","HealthCheckProtocol":"HTTP","HealthCheckTimeout":3,"HealthyThreshold":4,"UnhealthyThreshold":4}
&StickySessionConfig={"Cookie":"B490B5EBF6F3CD402E515D22BCDA1598","CookieTimeout":1000,"StickySessionEnabled":true,"StickySessionType":"Insert"}
&ServerGroupId=sgp-atstuj3rtop****
&<Common request parameters>

Sample success responses

XML format

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

<UpdateServerGroupAttributeResponse>
    <JobId>72dcd26b-f12d-4c27-b3af-18f6aed5****</JobId>
    <RequestId>365F4154-92F6-4AE4-92F8-7FF34B540710</RequestId>
</UpdateServerGroupAttributeResponse>

JSON format

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

{
  "JobId" : "72dcd26b-f12d-4c27-b3af-18f6aed5****",
  "RequestId" : "365F4154-92F6-4AE4-92F8-7FF34B540710"
}

Error codes

HTTP status code Error code Error message Description
400 IncorrectStatus.ServerGroup The status of %s [%s] is incorrect. The error message returned because the status of the server group is invalid.
404 ResourceNotFound.ServerGroup The specified resource %s is not found. The error message returned because the specified %s resource does not exist.

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