Update a server group's settings, such as health check, session persistence, name, scheduling algorithm, and protocol.
Operation description
The UpdateServerGroupAttribute API is asynchronous. After you call this API, the system returns a request ID and runs the update in the background. The configuration change is not immediate. You can call the ListServerGroups API to query the status of the server group:
A Configuring status indicates that the server group is being updated.
An Available status indicates that the update is complete.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
alb:UpdateServerGroupAttribute |
update |
*ServerGroup
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| ServerGroupName |
string |
No |
The name of the server group. The name must be 2 to 128 characters long, start with a letter, digit, or Chinese character, and can contain letters, digits, periods (.), underscores (_), hyphens (-), and spaces. |
test |
| Scheduler |
string |
No |
The scheduling algorithm. Valid values:
|
Wrr |
| ClientToken |
string |
No |
The client token, which is used to ensure the idempotence of the request. Generate a unique value on your client and ensure that the value is unique for each request. The client token can contain only ASCII characters. Note
If you do not specify this parameter, the system uses the RequestId of the API request as the client token. |
5A2CFF0E-5718-45B5-9D4D-70B3****** |
| DryRun |
boolean |
No |
Specifies whether to perform a dry run. Valid values:
|
true |
| HealthCheckConfig |
object |
No |
The health check settings. |
true |
| HealthCheckConnectPort |
integer |
No |
The port on the backend server that is used for health checks. Valid values: 0 to 65535. If you set this value to 0, the backend server's port is used for health checks. Note
This parameter takes effect only when HealthCheckEnabled is set to true. |
80 |
| HealthCheckEnabled |
boolean |
No |
Specifies whether to enable health checks. Valid values:
|
true |
| HealthCheckHost |
string |
No |
The domain name used for health checks.
Note
This parameter takes effect only when HealthCheckProtocol is set to HTTP, HTTPS, or gRPC. |
example.com |
| HealthCheckCodes |
array |
No |
The HTTP status codes that indicate a successful health check. |
|
|
string |
No |
The status code that indicates a successful health check.
Note
This parameter takes effect only when HealthCheckEnabled is set to true and HealthCheckProtocol is set to HTTP, HTTPS, or gRPC. |
200 |
|
| HealthCheckHttpVersion |
string |
No |
The HTTP version for health checks. Valid values:
Note
This parameter takes effect only when HealthCheckEnabled is set to true and HealthCheckProtocol is set to HTTP or HTTPS. |
HTTP1.1 |
| HealthCheckInterval |
integer |
No |
The interval, in seconds, between health checks. Valid values: 1 to 50. Note
This parameter takes effect only when HealthCheckEnabled is set to true. |
5 |
| HealthCheckMethod |
string |
No |
The method used for health checks. Valid values:
Note
This parameter takes effect only when HealthCheckEnabled is set to true and HealthCheckProtocol is set to HTTP, HTTPS, or gRPC. |
HEAD |
| HealthCheckPath |
string |
No |
The path to which health check requests are sent. The path must be 1 to 80 characters in length. It can contain letters, digits, and the following characters: Note
This parameter takes effect only when HealthCheckEnabled is set to true and HealthCheckProtocol is set to HTTP or HTTPS. |
/test/index.html |
| HealthCheckProtocol |
string |
No |
The protocol used for health checks. Valid values:
|
HTTP |
| HealthCheckTimeout |
integer |
No |
The timeout period, in seconds, for a health check response. If a backend server fails to respond within this period, the health check fails. Valid values: 1 to 300. Note
This parameter takes effect only when HealthCheckEnabled is set to true. |
3 |
| HealthyThreshold |
integer |
No |
The number of consecutive successful health checks required for a server's status to change from fail to success. Valid values: 2 to 10. |
4 |
| UnhealthyThreshold |
integer |
No |
The number of consecutive failed health checks required for a server's status to change from success to fail. Valid values: 2 to 10. |
4 |
| StickySessionConfig |
object |
No |
The sticky session settings. |
|
| Cookie |
string |
No |
The cookie that is configured on the server. The cookie must be 1 to 200 characters long and consist of ASCII characters. It cannot contain commas (,), semicolons (;), or spaces, and cannot start with a dollar sign ($). Note
This parameter takes effect only when StickySessionEnabled is set to true and StickySessionType is set to Server. |
B490B5EBF6F3CD402E515D22B****** |
| CookieTimeout |
integer |
No |
The cookie timeout period, in seconds. Valid values: 1 to 86400. Note
This parameter takes effect only when StickySessionEnabled is set to true and StickySessionType is set to Insert. |
1000 |
| StickySessionEnabled |
boolean |
No |
Specifies whether to enable sticky sessions. Valid values:
|
false |
| StickySessionType |
string |
No |
The method used to handle cookies. Valid values:
Note
This parameter takes effect only when StickySessionEnabled is set to true. |
Insert |
| ServerGroupId |
string |
Yes |
The ID of the server group. |
sgp-atstuj3rtop**** |
| UpstreamKeepaliveEnabled |
boolean |
No |
Specifies whether to enable persistent connections to backend servers.
|
sgp-123 |
| ServiceName |
string |
No |
The name of the corresponding Kubernetes (K8s) |
test2 |
| UchConfig |
object |
No |
The settings for URL-based consistent hashing. |
|
| Type |
string |
Yes |
The type of the parameter. Only |
QueryString |
| Value |
string |
Yes |
The name of the query string parameter to use for consistent hashing. |
abc |
| ConnectionDrainConfig |
object |
No |
The connection draining settings. If connection draining is enabled, the load balancer allows existing connections to be processed for a specified period of time after a backend server is removed or declared unhealthy. Note
|
|
| ConnectionDrainEnabled |
boolean |
No |
Specifies whether to enable connection draining.
|
false |
| ConnectionDrainTimeout |
integer |
No |
The connection draining timeout period, in seconds. Valid values: 0 to 900. |
300 |
| SlowStartConfig |
object |
No |
The slow start settings. If you enable slow start, the load balancer warms up a newly added backend server over a specified period. During this warm-up period, the number of requests routed to the server increases linearly. Note
|
|
| SlowStartEnabled |
boolean |
No |
Specifies whether to enable slow start.
|
false |
| SlowStartDuration |
integer |
No |
The duration of the slow start period, in seconds. Valid values: 30 to 900. |
30 |
| CrossZoneEnabled |
boolean |
No |
Specifies whether to enable cross-zone load balancing for the server group. Valid values:
Note
|
true |
| IpVersionAffinityMode |
string |
No |
The IP version affinity mode. |
Affinity |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response data. |
||
| JobId |
string |
The ID of the asynchronous task. |
72dcd26b-f12d-4c27-b3af-18f6aed5**** |
| RequestId |
string |
The ID of the request. |
365F4154-92F6-4AE4-92F8-7FF3***** |
Examples
Success response
JSON format
{
"JobId": "72dcd26b-f12d-4c27-b3af-18f6aed5****",
"RequestId": "365F4154-92F6-4AE4-92F8-7FF3*****"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | IncorrectStatus.ServerGroup | The status of %s [%s] is incorrect. | The status of %s [%s] is incorrect. |
| 400 | Mismatch.LoadBalancerEditionAndConnectionDrain | The %s and %s are mismatched. | The %s and %s are mismatched. |
| 400 | Mismatch.ServerGroupSchedulerAndSlowStartEnable | The %s and %s are mismatched. | The %s and %s are mismatched. |
| 400 | QuotaExceeded.ConnectionDrainTimeout | The quota of %s is exceeded, usage %s/%s. | The quota of %s is exceeded, usage %s/%s. |
| 400 | UnsupportedFeature.ConnectionDrain | The feature of %s is not supported. | The feature of %s is not supported. |
| 400 | QuotaExceeded.SlowStartDuration | The quota of %s is exceeded, usage %s/%s. | The quota of %s is exceeded, usage %s/%s. |
| 400 | UnsupportedFeature.SlowStart | The feature of %s is not supported. | |
| 400 | Mismatch.LoadBalancerEditionAndSlowStartEnable | The %s and %s are mismatched. | The %s and %s are mismatched. |
| 400 | OperationDenied.UpstreamKeepaliveDisabled | The operation is not allowed because of UpstreamKeepaliveDisabled. | Updating not allowed Backend long connection is closed |
| 400 | OperationDenied.UpstreamKeepaliveEnabled | The operation is not allowed because of UpstreamKeepaliveEnabled. | Update not allowed to open Backend Long connection is in the open state |
| 400 | CloseUpstreamKeepaliveNotSupport | The param of UpstreamKeepalive is not Support. | close keepalive attribute for server group is not supported |
| 404 | ResourceNotFound.ServerGroup | The specified resource %s is not found. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.