All Products
Search
Document Center

Server Load Balancer:ListServerGroups

Last Updated:Jan 21, 2026

Queries server groups.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

alb:ListServerGroups

get

*ServerGroup

acs:alb:{#regionId}:{#accountId}:servergroup/*

None None

Request parameters

Parameter

Type

Required

Description

Example

ServerGroupIds

array

No

The server group IDs.

string

No

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

sgp-atstuj3rtop****

ServerGroupNames

array

No

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

string

No

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

Group3

ResourceGroupId

string

No

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

rg-atstuj3rtop****

NextToken

string

No

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****

MaxResults

integer

No

The number of entries per page. Valid values: 1 to 100. Default value: 20.

20

VpcId

string

No

The ID of the virtual private cloud (VPC).

vpc-bp15zckdt37pq72zv****

ServerGroupType

string

No

The server group type. Valid values:

  • Instance: instances, including ECS instances, ENIs, and elastic container instances.

  • Ip: IP addresses.

  • Fc: Function Compute

Instance

Tag

array<object>

No

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

Instance

object

No

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

Key

string

No

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

Value

string

No

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 elements

Element

Type

Description

Example

object

The response parameters.

MaxResults

integer

The number of entries returned per page.

50

NextToken

string

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****

RequestId

string

The request ID.

CEF72CEB-54B6-4AE8-B225-F876******

ServerGroups

array<object>

The server groups.

array<object>

The server groups.

HealthCheckConfig

object

The health check configurations.

HealthCheckConnectPort

integer

The backend port that is used for health checks. Valid values: 0 to 65535.

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

80

HealthCheckEnabled

boolean

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

  • true

  • false

true

HealthCheckHost

string

The domain name that is used for health checks.

  • Backend Server Internal IP (default): Use the internal IP address of backend servers as the health check domain name.

  • Custom Domain Name: Enter a domain name.

    • 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 if HealthCheckProtocol is set to HTTP, HTTPS, or gRPC.

www.example.com

HealthCheckCodes

array

The HTTP status codes that indicate healthy backend servers.

string

The HTTP status codes that indicate healthy backend servers.

  • When HealthCheckProtocol is set to HTTP or HTTPS, you can set HealthCheckCodes to http_2xx, http_3xx, http_4xx, and http_5xx. Multiple HTTP status codes are separated by commas (,).

  • When HealthCheckProtocol is set to gRPC, the valid values of HealthCheckCodes are 0 to 99. Value ranges are supported. At most 20 value ranges are supported. Multiple value ranges are separated by commas (,).

Note

This parameter takes effect only if HealthCheckProtocol is set to HTTP, HTTPS, or gRPC.

http_2xx

HealthCheckHttpVersion

string

The HTTP version that is used for health checks.

Valid values: HTTP1.0 and HTTP1.1.

Note

This parameter takes effect only if HealthCheckProtocol is set to HTTP or HTTPS.

HTTP1.1

HealthCheckInterval

integer

The interval at which health checks are performed. Unit: seconds. Valid values: 1 to 50.

5

HealthCheckMethod

string

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 use the POST method by default.

  • HEAD: HTTP and HTTPS health checks use the HEAD method by default.

Note

This parameter takes effect only if HealthCheckProtocol is set to HTTP, HTTPS, or gRPC.

HEAD

HealthCheckPath

string

The URL that is used for health checks.

Note

This parameter takes effect only if HealthCheckProtocol is set to HTTP or HTTPS.

/test/index.html

HealthCheckProtocol

string

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

  • HTTP: HTTP health checks simulate browser behaviors by sending HEAD or GET requests to probe the availability of backend servers.

  • HTTPS: HTTPS health checks simulate browser behaviors by sending HEAD or GET requests to probe the availability of backend servers. HTTPS supports encryption and provides higher security than HTTP.

  • TCP: TCP health checks send TCP SYN packets to a backend server to check whether the port of the backend server is reachable.

  • gRPC: gRPC health checks send POST or GET requests to a backend server to check whether the backend server is healthy.

HTTP

HealthCheckTimeout

integer

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

3

HealthyThreshold

integer

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

UnhealthyThreshold

integer

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

Protocol

string

The backend protocol. Valid values:

  • HTTP: allows you to associate HTTPS, HTTP, or QUIC listeners with backend servers.

  • HTTPS: allows you to associate HTTPS listeners with backend servers.

  • GRPC: allows you to associate HTTPS and QUIC listeners with backend servers.

HTTP

RelatedLoadBalancerIds

array

The ID of the ALB instance associated with the server group.

string

The ID of the ALB instance.

alb-n5qw04uq8savfe****

ResourceGroupId

string

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

rg-atstuj3rtop****

Scheduler

string

The scheduling algorithm. Valid values:

  • Wrr: weighted round-robin. Backend servers with higher weights receive more requests than backend servers with lower weights.

  • Wlc: weighted least connections. 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: consistent hashing. Requests that have the same hash factors are distributed to the same backend server. If you do not specify the UchConfig parameter, the source IP address is used as the hash factor by default. Requests that are from the same IP address are distributed to the same backend server. If you specify the UchConfig parameter, the URL string is used as the hash factor. Requests that have the same URL string are distributed to the same backend server.

Wrr

ServerGroupId

string

The server group ID.

sgp-cige6j****

ServerGroupName

string

The server group name.

Group3

ServerGroupStatus

string

The status of the server group. Valid values:

  • Creating.

  • Available

  • Configuring

Available

ServerGroupType

string

The server group type. Valid values:

  • Instance: instances, including ECS instances, ENIs, and elastic container instances.

  • Ip: IP addresses.

  • Fc: Function Compute

Instance

StickySessionConfig

object

The configuration of session persistence.

Cookie

string

The cookie configured for the server.

B490B5EBF6F3CD402E515D22BCDA****

CookieTimeout

integer

The timeout period of the 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

StickySessionEnabled

boolean

Indicates whether session persistence is enabled. Valid values:

  • true

  • false

false

StickySessionType

string

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

  • insert: inserts the cookie. The first time a client accesses ALB, ALB inserts the SERVERID cookie into the HTTP or HTTPS response packet. Subsequent requests from the client that carry this cookie are forwarded to the same backend server as the first request.

  • Server: rewrites the cookie. ALB rewrites the custom cookies in requests from a client. Subsequent requests from the client that carry the new cookie are forwarded to the same backend server as the first request.

Insert

VpcId

string

The ID of the VPC to which the ALB instance belongs.

vpc-bp15zckdt37pq72zv****

Tags

array<object>

The tags that are added to the server group.

object

The tags that are added to the server group.

Key

string

The tag key.

Test

Value

string

The tag value.

Test

ConfigManagedEnabled

boolean

Indicates whether configuration management is enabled. Valid values:

  • true

  • false

false

UpstreamKeepaliveEnabled

boolean

Indicates whether persistent TCP connections are enabled. Valid values:

  • true

  • false

false

Ipv6Enabled

boolean

Indicates whether IPv6 is supported. Valid values:

  • true

  • false

false

ServerCount

integer

The number of backend servers in the server group.

1

ServiceName

string

The name of the server group.

test

UchConfig

object

The configuration of consistent hashing based on URLs.

Type

string

The parameter type. Valid value: QueryString.

QueryString

Value

string

The hash value.

abc

CreateTime

string

The time when the resource was created.

2022-07-02T02:49:05Z

ConnectionDrainConfig

object

The configurations of connection draining.

After connection draining is enabled, ALB maintains data transmission for a period of time after the backend server is removed or declared unhealthy.

Note
  • Basic ALB instances do not support connection draining. Standard and WAF-enabled ALB instances support connection draining.

  • Server groups of the instance and IP types support connection draining. Server groups of the Function Compute type do not support connection draining.

ConnectionDrainEnabled

boolean

Indicates whether connection draining is enabled. Valid values:

  • true

  • false

false

ConnectionDrainTimeout

integer

The timeout period of connection draining.

300

SlowStartConfig

object

The configurations of slow starts.

After slow starts are enabled, ALB prefetches data to newly added backend servers. Requests distributed to the backend servers gradually increase.

Note
  • Basic ALB instances do not support slow starts. Standard and WAF-enabled ALB instances support slow starts.

  • Server groups of the instance and IP types support slow starts. Server groups of the Function Compute type do not support slow starts.

  • Slow start is supported only by the weighted round-robin scheduling algorithm.

SlowStartEnabled

boolean

Indicates whether slow starts are enabled. Valid values:

  • true

  • false

false

SlowStartDuration

integer

The duration of a slow start.

30

CrossZoneEnabled

boolean

Indicates whether cross-zone load balancing is enabled. Valid values:

  • true (default)

  • false

true

TotalCount

integer

The total number of entries returned.

1000

Examples

Success response

JSON format

{
  "MaxResults": 50,
  "NextToken": "caeba0bbb2be03f8****",
  "RequestId": "CEF72CEB-54B6-4AE8-B225-F876******",
  "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",
      "RelatedLoadBalancerIds": [
        "alb-n5qw04uq8savfe****"
      ],
      "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",
      "ConnectionDrainConfig": {
        "ConnectionDrainEnabled": false,
        "ConnectionDrainTimeout": 300
      },
      "SlowStartConfig": {
        "SlowStartEnabled": false,
        "SlowStartDuration": 30
      },
      "CrossZoneEnabled": true
    }
  ],
  "TotalCount": 1000
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.