All Products
Search
Document Center

Server Load Balancer:ListServerGroups

Last Updated:Sep 02, 2026

Queries a list of 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 IDs of the server groups.

string

No

The ID of the server group. You can specify up to 20 server group IDs in a single request.

sgp-atstuj3rtop****

ServerGroupNames

array

No

The names of the server groups. You can specify up to 10 names.

string

No

The name of the server group. You can specify up to 10 server group names in a single request.

Group3

ResourceGroupId

string

No

The resource group ID.

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 or if no next query exists.

  • If a next query exists, set the value to the NextToken value returned in the previous API call.

FFmyTO70tTpLG6I3FmYAXG****

MaxResults

integer

No

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

20

VpcId

string

No

The ID of the VPC-connected instance.

vpc-bp15zckdt37pq72zv****

ServerGroupType

string

No

The type of the server group. Valid values:

  • Instance: server type, which includes ECS, ENI, and ECI instances.

  • Ip: IP address type.

  • Fc: Function Compute type.

  • If you leave this parameter empty, all types of server groups are queried.

Instance

Tag

array<object>

No

The tags that are bound to the server group. You can specify up to 10 tags in a single request.

Instance

object

No

The tag that is bound to the server group. You can specify up to 10 tags in a single request.

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 start with aliyun or acs:. It cannot contain http:// or https://.

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 start with aliyun or acs:. It cannot contain http:// or https://.

Test

Response elements

Element

Type

Description

Example

object

The response struct.

MaxResults

integer

The number of entries per page in a paginated query.

50

NextToken

string

Indicates whether a next query exists. Valid values:

  • If NextToken is empty, no next query exists.

  • If NextToken is returned, the value indicates the token that is used to start the next query.

caeba0bbb2be03f8****

RequestId

string

The request ID.

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

ServerGroups

array<object>

The list of backend server groups.

array<object>

The list of backend server groups.

HealthCheckConfig

object

The health check configuration.

HealthCheckConnectPort

integer

The port of the backend server used for health checks. Valid values: 0 to 65535.

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

80

HealthCheckEnabled

boolean

Indicates whether health checks are enabled. Valid values:

  • true: Enabled.

  • false: Disabled.

true

HealthCheckHost

string

The domain name used for health checks.

  • Use the internal IP address of the backend server (default): The internal IP address of the backend server is used as the health check domain name.

  • Specify a domain name: Enter a domain name.

    • 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 (.). Periods (.) cannot appear at the beginning or end.

    • The rightmost domain label can contain only letters, not digits or hyphens (-).

    • Hyphens (-) cannot appear at the beginning or end.

Note

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

www.example.com

HealthCheckCodes

array

The list of status codes that indicate healthy health checks.

string

The status code that indicates a healthy health check.

  • If HealthCheckProtocol is set to HTTP or HTTPS, HealthCheckCodes can be set to http_2xx, http_3xx, http_4xx, or http_5xx. Separate multiple status codes with commas (,).

  • If HealthCheckProtocol is set to gRPC, the valid values of HealthCheckCodes range from 0 to 99. Range input is supported, with a maximum of 20 range values. Separate multiple range values with commas (,).

Note

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

http_2xx

HealthCheckHttpVersion

string

The HTTP version for health checks.

Valid values: HTTP1.0 or HTTP1.1.

Note

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

HTTP1.1

HealthCheckInterval

integer

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

5

HealthCheckMethod

string

The health check method. Valid values:

  • GET: If the response body exceeds 8 KB, it is truncated, but this does not affect the health check result.

  • POST: gRPC listener health checks use the POST method by default.

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

Note

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

HEAD

HealthCheckPath

string

The path of the forwarding rule for health checks.

Note

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

/test/index.html

HealthCheckProtocol

string

The health check protocol. Valid values:

  • HTTP: Sends HEAD or GET requests to simulate browser access behavior and check whether the server application is healthy.

  • HTTPS: Sends HEAD or GET requests to simulate browser access behavior and check whether the server application is healthy. (Data encryption is used, which is more secure than HTTP.)

  • TCP: Sends SYN handshake packets to check whether the server port is alive.

  • gRPC: Sends POST or GET requests to check whether the server application is healthy.

HTTP

HealthCheckTimeout

integer

The amount of time to wait for a response from a health check. If the backend server does not respond correctly within the specified time, the health check fails. Unit: seconds.

3

HealthyThreshold

integer

The number of consecutive successful health checks required before the health check status of a backend server changes from fail to success.

4

UnhealthyThreshold

integer

The number of consecutive failed health checks required before the health check status of a backend server changes from success to fail.

4

Protocol

string

The backend protocol type. Valid values:

  • HTTP: Can be associated with HTTPS, HTTP, and QUIC listeners.

  • HTTPS: Can be associated with HTTPS listeners.

  • GRPC: Can be associated with HTTPS and QUIC listeners.

HTTP

RelatedLoadBalancerIds

array

The IDs of the associated instances.

string

The ID of the associated load balancing instance.

alb-n5qw04uq8savfe****

ResourceGroupId

string

The resource group ID.

rg-atstuj3rtop****

Scheduler

string

The scheduling algorithm. Valid values:

  • Wrr: Weighted round-robin. Backend servers with higher weights are polled more frequently.

  • Wlc: Weighted least connections. In addition to polling based on the weight of each backend server, the actual load (number of connections) of the backend server is also considered. When the weights are the same, backend servers with fewer current connections are polled more frequently.

  • Sch: Consistent hashing. Requests with the same hash factor are dispatched to the same backend server. If the UchConfig parameter is not configured, the default hash factor is the source IP address, and requests from the same source IP address are distributed to the same backend server. If the UchConfig parameter is configured, the hash factor is the URL parameter, and requests with the same URL parameter 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 server group status. Valid values:

  • Creating: The server group is being created.

  • Available: The server group is available.

  • Configuring: The server group is being configured.

Available

ServerGroupType

string

The server group type. Valid values:

  • Instance: Server type, including ECS, ENI, and ECI instances.

  • Ip: IP address type.

  • Fc: Function Compute type.

Instance

StickySessionConfig

object

The session persistence configuration struct.

Cookie

string

The cookie configured on the server.

B490B5EBF6F3CD402E515D22BCDA****

CookieTimeout

integer

The cookie timeout period. 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: Enabled.

  • false: Disabled.

false

StickySessionType

string

The method used to handle cookies. Valid values:

  • Insert: Inserts a cookie. When a client accesses the server for the first time, load balancing inserts a cookie (SERVERID) into the HTTP or HTTPS response. The next time the client accesses the server with this cookie, load balancing forwards the request to the previously recorded backend server.

  • Server: Rewrites a cookie. When load balancing detects a user-defined cookie, it rewrites the original cookie. The next time the client accesses the server with the new cookie, load balancing forwards the request to the previously recorded backend server.

Insert

VpcId

string

The VPC instance ID.

vpc-bp15zckdt37pq72zv****

Tags

array<object>

The list of tags bound to the server group.

object

The list of tags bound 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: Enabled.

  • false: Disabled.

false

UpstreamKeepaliveEnabled

boolean

Indicates whether backend keepalive is enabled. Valid values:

  • true: Enabled.

  • false: Disabled.

false

Ipv6Enabled

boolean

Indicates whether IPv6 is supported. Valid values:

  • true: Supported.

  • false: Not supported.

false

ServerCount

integer

The number of servers in the server group.

1

ServiceName

string

The service name.

test

UchConfig

object

The URL consistent hashing parameter settings.

Type

string

The parameter type. Only QueryString is supported.

QueryString

Value

string

The consistent hashing parameter value.

abc

CreateTime

string

The time when the resource was created.

2022-07-02T02:49:05Z

ConnectionDrainConfig

object

The connection draining configuration.

After connection draining is enabled, when a backend server is removed or a health check has failed, load balancing allows existing connections to continue Normal data transmission for a specified period of time before the connection is subject to break.

Note
  • Basic Edition instances do not support connection draining. Only Standard Edition and WAF-enabled Edition instances support this feature.

  • Server type and IP type server groups support connection draining. Function Compute type server groups do not.

ConnectionDrainEnabled

boolean

Indicates whether connection draining is enabled.

  • true: Enabled.

  • false: Disabled.

false

ConnectionDrainTimeout

integer

The connection draining timeout period.

300

SlowStartConfig

object

The slow start configuration.

After slow start is enabled, newly added backend servers in the server group are warmed up within the specified period of time. The number of requests forwarded to the server increases linearly.

Note
  • Basic Edition instances do not support slow start. Only Standard Edition and WAF-enabled Edition instances support this feature.

  • Server type and IP backend server groups support slow start configuration. Function Compute backend server groups do not.

  • Slow start can be enabled only when the backend scheduling algorithm is weighted round-robin.

SlowStartEnabled

boolean

Indicates whether slow start is enabled.

  • true: Enabled.

  • false: Disabled.

false

SlowStartDuration

integer

The slow start duration.

30

CrossZoneEnabled

boolean

Indicates whether cross-zone load balancing is enabled for the server group. Valid values:

  • true: Enabled (default).

  • false: Disabled.

true

IpVersionAffinityMode

string

The IP version affinity mode of the server group.

Affinity

TotalCount

integer

The 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,
      "IpVersionAffinityMode": "Affinity"
    }
  ],
  "TotalCount": 1000
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.