All Products
Search
Document Center

Server Load Balancer:ListServerGroups

Last Updated:Mar 01, 2024

Queries server groups in a region.

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
alb:ListServerGroupsRead
  • ServerGroup
    acs:alb:{#regionId}:{#accountId}:servergroup/*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
ServerGroupIdsarrayNo

The server group IDs.

stringNo

The IDs of the server groups to be queried. You can specify up to 20 IDs in each call.

sgp-atstuj3rtop****
ServerGroupNamesarrayNo

The names of the server groups to be queried. You can specify at most 10 server group names.

stringNo

The names of the server groups to be queried. You can specify up to 10 server group names in each call.

Group3
ResourceGroupIdstringNo

The ID of the resource group to which the server group belongs.

rg-atstuj3rtop****
NextTokenstringNo

The pagination token that is used in the next request to retrieve a new page of results. Valid values:

  • You do not need to specify this parameter for the first request.
  • You must specify the token that is obtained from the previous query as the value of NextToken.
FFmyTO70tTpLG6I3FmYAXG****
MaxResultsintegerNo

The number of entries to return on each page. Valid values: 1 to 100. Default value: 20.

20
VpcIdstringNo

The ID of the virtual private cloud (VPC).

vpc-bp15zckdt37pq72zv****
Tagobject []No

The tags that are added to the server group. You can specify up to 10 tags in each call.

KeystringNo

The tag key. You can specify up to 10 tag keys.

The tag key can be up to 64 characters in length and cannot contain http:// or https://. It cannot start with aliyun or acs:.

Test
ValuestringNo

The tag value. You can specify up to 10 tag values.

The tag value can be up to 128 characters in length, and cannot contain http:// or https://. It cannot start with aliyun or acs:.

Test

Response parameters

ParameterTypeDescriptionExample
object

The response parameters.

MaxResultsinteger

The number of entries returned per page.

50
NextTokenstring

The pagination token that is used in the next request to retrieve a new page of results. Valid values:

  • If NextToken is empty, no next page exists.
  • If NextToken is not empty, the value of NextToken can be used in the next request to retrieve a new page of results.
caeba0bbb2be03f8****
RequestIdstring

The request ID.

CEF72CEB-54B6-4AE8-B225-F876FF7BA984
ServerGroupsobject []

A list of server groups.

HealthCheckConfigobject

The health check configuration.

HealthCheckConnectPortinteger

The port that you want to use for health checks on backend servers. Valid values: 0 to 65535.

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

80
HealthCheckEnabledboolean

Indicates whether the health check feature is enabled. Valid values:

  • true
  • false
true
HealthCheckHoststring

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

  • The domain name is 1 to 80 characters in length.
  • The domain name contains lowercase letters, digits, hyphens (-), and periods (.).
  • The domain name contains at least one period (.) but does not start or end with a period (.).
  • The rightmost domain label of the domain name contains only letters, and does not contain digits or hyphens (-).
  • The domain name does not start or end with a hyphen (-).
Note This parameter takes effect only when HealthCheckProtocol is set to HTTP or HTTPS. HTTPS is unavailable by default. If you want to use HTTPS, log on to the SLB console, go to the Quota Center page, and then apply for the privilege to use HTPS on the ALB tab.
www.example.com
HealthCheckCodesarray

The HTTP status codes that indicate whether the backend server passes the health check.

string

The HTTP status codes that indicate a successful health check.

  • You can set HealthCheckCodes to http_2xx, http_3xx, http_4xx, and http_5xx when HealthCheckProtocol is set to HTTP or HTTPS. Separate multiple HTTP status codes with a comma (,).
  • If HealthCheckProtocol is set to gRPC, HealthCheckCodes can be set to 0 to 99. Value ranges are supported. You can enter at most 20 value ranges and must separate them with commas (,).
Note This parameter takes effect when HealthCheckProtocol is set to HTTP, HTTPS, or gRPC. HTTPS is unavailable by default. If you want to use HTTPS, log on to the SLB console, go to the Quota Center page, and then apply for the privilege to use HTTPS on the ALB tab.
http_2xx
HealthCheckHttpVersionstring

The HTTP version that is used for health checks.

Valid values: HTTP1.0 and HTTP1.1.

Note This parameter takes effect when HealthCheckProtocol is set to HTTP or HTTPS. HTTPS is unavailable by default. If you want to use HTTPS, log on to the SLB console, go to the Quota Center page, and then apply for the privilege to use HTPS on the ALB tab.
HTTP1.1
HealthCheckIntervalinteger

The interval between two consecutive health checks. Unit: seconds. Valid values: 1 to 50.

5
HealthCheckMethodstring

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

  • GET: If the length of a response exceeds 8 KB, the response is truncated. However, the health check result is not affected.
  • POST: gRPC health checks on listeners use the POST method by default.
  • HEAD: HTTP and HTTPS health checks on listeners use the HEAD method by default.
Note This parameter takes effect when HealthCheckProtocol is set to HTTP, HTTPS, or gRPC. HTTPS is unavailable by default. If you want to use HTTPS, log on to the SLB console, go to the Quota Center page, and then apply for the privilege to use HTTPS on the ALB tab.
HEAD
HealthCheckPathstring

The path that is used for health checks.

Note This parameter takes effect only when HealthCheckProtocol is set to HTTP or HTTPS. HTTPS is unavailable by default. If you want to use HTTPS, log on to the SLB console, go to the Quota Center page, and then apply for the privilege to use HTPS on the ALB tab.
/test/index.html
HealthCheckProtocolstring

The protocol that you want to use for health checks. Valid values:

  • HTTP: ALB performs HTTP health checks by sending HEAD or GET requests to a backend server to check whether the backend server is healthy.
  • HTTPS: ALB performs HTTPS health checks by sending HEAD or GET requests to a backend server to check whether the backend server is healthy. HTTPS supports data encryption and provides higher data security than HTTP.
  • TCP: To perform TCP health checks, ALB sends SYN packets to the backend server to check whether the port of the backend server is available to receive requests.
  • gRPC: ALB performs gRPC health checks by sending POST or GET requests to a backend server to check whether the backend server is healthy.
Note HTTPS is unavailable by default. If you want to use HTTPS, log on to the SLB console, go to the Quota Center page, and then apply for the privilege to use HTTPS on the ALB tab.
HTTP
HealthCheckTimeoutinteger

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

3
HealthyThresholdinteger

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.

4
UnhealthyThresholdinteger

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.

4
Protocolstring

The backend protocol. Valid values:

  • HTTP: allows you to associate HTTPS, HTTP, or QUIC listeners with backend servers.
  • HTTPS: allows you to associate an HTTPS listener with the server group.
  • GRPC: allows you to associate an HTTPS or QUIC listener with the server group.
HTTP
ResourceGroupIdstring

The resource group ID to which the GA instance belongs.

rg-atstuj3rtop****
Schedulerstring

The scheduling algorithm. Valid values:

  • Wrr: Backend servers with higher weights receive more requests than backend servers with lower weights.
  • Wlc: Requests are distributed based on the weight and load of each backend server. The load refers to the number of connections on a backend server. If multiple backend servers have the same weight, requests are forwarded to the backend server with the least number of connections.
  • Sch: The consistent hashing algorithm is used. Requests from the same source IP address are distributed to the same backend server.
Wrr
ServerGroupIdstring

The ID of the server group.

sgp-cige6j****
ServerGroupNamestring

The name of the server group.

Group3
ServerGroupStatusstring

The status of the server group. Valid values:

  • Creating
  • Available
  • Configuring
Available
ServerGroupTypestring

The type of server group. Valid values:

  • Instance
  • Ip
  • Fc
Instance
StickySessionConfigobject

The configuration of session persistence.

Cookiestring

The cookie that is configured on the server.

B490B5EBF6F3CD402E515D22BCDA****
CookieTimeoutinteger

The timeout period of a cookie. Unit: 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
StickySessionEnabledboolean

Indicates whether session persistence is enabled. Valid values:

  • true
  • false
false
StickySessionTypestring

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

  • Insert: inserts a cookie. ALB inserts a cookie (SERVERID) into the first HTTP or HTTPS response packet that is sent to a client. The next request from the client contains this cookie and the listener distributes this request to the recorded backend server.
  • Server: rewrites a cookie. When ALB detects a user-defined cookie, it overwrites the original cookie with the user-defined cookie. Subsequent requests to ALB carry this user-defined cookie, and ALB determines the destination servers of the requests based on the cookies.
Insert
VpcIdstring

The VPC ID.

vpc-bp15zckdt37pq72zv****
Tagsobject []

The tags that are added to the server group.

Keystring

The tag key.

Test
Valuestring

The tag value.

Test
ConfigManagedEnabledboolean

Indicates whether configuration management is enabled. Valid values:

  • true
  • false
false
UpstreamKeepaliveEnabledboolean

Indicates whether long-lived TCP connections are enabled. Valid values:

  • true
  • false
false
Ipv6Enabledboolean

Indicates whether IPv6 is supported. Valid values:

  • true
  • false
false
ServerCountinteger

The number of backend servers in the server group.

1
ServiceNamestring

The service name.

test
UchConfigobject

The configuration of consistent hashing based on URLs.

Typestring

The data type of the common parameter.

QueryString
Valuestring

The parameter value for consistent hashing.

abc
CreateTimestring

The time when the resource was created.

2022-07-02T02:49:05Z
TotalCountinteger

The total number of entries returned.

1000

Examples

Sample success responses

JSONformat

{
  "MaxResults": 50,
  "NextToken": "caeba0bbb2be03f8****",
  "RequestId": "CEF72CEB-54B6-4AE8-B225-F876FF7BA984",
  "ServerGroups": [
    {
      "HealthCheckConfig": {
        "HealthCheckConnectPort": 80,
        "HealthCheckEnabled": true,
        "HealthCheckHost": "www.example.com",
        "HealthCheckCodes": [
          "http_2xx"
        ],
        "HealthCheckHttpVersion": "HTTP1.1",
        "HealthCheckInterval": 5,
        "HealthCheckMethod": "HEAD",
        "HealthCheckPath": "/test/index.html",
        "HealthCheckProtocol": "HTTP",
        "HealthCheckTimeout": 3,
        "HealthyThreshold": 4,
        "UnhealthyThreshold": 4
      },
      "Protocol": "HTTP",
      "ResourceGroupId": "rg-atstuj3rtop****",
      "Scheduler": "Wrr",
      "ServerGroupId": "sgp-cige6j****",
      "ServerGroupName": "Group3",
      "ServerGroupStatus": "Available",
      "ServerGroupType": "Instance",
      "StickySessionConfig": {
        "Cookie": "B490B5EBF6F3CD402E515D22BCDA****",
        "CookieTimeout": 1000,
        "StickySessionEnabled": false,
        "StickySessionType": "Insert"
      },
      "VpcId": "vpc-bp15zckdt37pq72zv****",
      "Tags": [
        {
          "Key": "Test",
          "Value": "Test"
        }
      ],
      "ConfigManagedEnabled": false,
      "UpstreamKeepaliveEnabled": false,
      "Ipv6Enabled": false,
      "ServerCount": 1,
      "ServiceName": "test",
      "UchConfig": {
        "Type": "QueryString",
        "Value": "abc"
      },
      "CreateTime": "2022-07-02T02:49:05Z"
    }
  ],
  "TotalCount": 1000
}

Error codes

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

Change history

Change timeSummary of changesOperation
2024-02-23The response structure of the API has changedsee changesets
Change itemChange content
Output ParametersThe response structure of the API has changed.
2023-12-28The request parameters of the API has changed. The response structure of the API has changedsee changesets
Change itemChange content
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: ServerGroupType
Output ParametersThe response structure of the API has changed.
2023-04-11The response structure of the API has changedsee changesets
Change itemChange content
Output ParametersThe response structure of the API has changed.