All Products
Search
Document Center

Server Load Balancer:ListServerGroups

Last Updated:Oct 23, 2026

Queries a list of load balancing 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

gwlb:ListServerGroups

get

ServerGroup

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

ServerGroup

acs:gwlb:{#regionId}:{#accountId}:servergroup/{#ServerGroupId}

VPC

acs:vpc:{#regionId}:{#accountId}:vpc/{#VpcId}

None None

Request parameters

Parameter

Type

Required

Description

Example

ServerGroupIds

array

No

The list of server group IDs.

You can specify up to 20 server group IDs at a time.

string

No

The server group ID.

sgp-atstuj3rtoptyui****

ServerGroupNames

array

No

The list of server group names.

You can specify up to 20 server group names at a time.

string

No

The server group name.

testServerGroupName

ServerGroupType

string

No

The server group type. Valid values:

  • Instance: Server type. This type of server group supports adding Ecs, Eni, and Eci instances.

  • Ip: IP address type. This type of server group supports adding backend servers by IP address.

Valid values:

  • Instance :

    Server type.

  • Ip :

    IP address type.

Instance

ResourceGroupId

string

No

The resource group ID.

rg-atstuj3rtop****

Tag

array<object>

No

The list of tags.

You can specify up to 20 tags in a single call.

object

No

The tag.

Key

string

No

The tag key. If specified, the value cannot be an empty string. The tag key can be up to 128 characters in length, and cannot start with aliyun or acs:. It cannot contain http:// or https://.

testTagKey

Value

string

No

The tag value. The tag value can be up to 256 characters in length, and cannot contain http:// or https://.

testTagValue

VpcId

string

No

The VPC ID.

vpc-bp15zckdt37pq72zv****

NextToken

string

No

The token for the next query. Valid values:

  • If NextToken is empty, no next query is available.

  • If NextToken returns a value, the value is the token used to start the next query.

FFmyTO70tTpLG6I3FmYAXGKPd****

MaxResults

integer

No

The number of entries to return per page.

Valid values: 1 to 1000.

Default value: 20.

20

Skip

integer

No

The number of entries to skip during the query.

1

Response elements

Element

Type

Description

Example

object

The response data structure.

MaxResults

integer

The number of entries returned per page.

Valid values: 1 to 1000.

20

NextToken

string

The token for the next query. Valid values:

  • If NextToken is empty, no next query is available.

  • If NextToken returns a value, the value is the token used to start the next query.

FFmyTO70tTpLG6I3FmYAXGKPd****

RequestId

string

The request ID.

54B48E3D-DF70-471B-AA93-08E683A1B45

ServerGroups

array<object>

The list of backend server groups.

array<object>

The backend server group.

ConnectionDrainConfig

object

The connection draining configurations.

ConnectionDrainEnabled

boolean

Indicates whether connection draining is enabled. Valid values:

  • true: Enabled.

  • false: Disabled.

false

ConnectionDrainTimeout

integer

The connection draining timeout period.

Unit: seconds.

Valid values: 1 to 3600.

300

CreateTime

string

The time when the resource was created. The time is displayed in UTC in the yyyy-MM-ddTHH:mm:ssZ format.

2024-08-05T18:24:07Z

HealthCheckConfig

object

The health check configurations.

HealthCheckConnectPort

integer

The port of the backend server used for health checks.

Valid values: 1 to 65535.

80

HealthCheckConnectTimeout

integer

The maximum timeout period for a health check response.

Unit: seconds.

Valid values: 1 to 300.

5

HealthCheckDomain

string

The domain name used for health checks. Valid values:

  • $SERVER_IP: the internal IP address of the backend server.

  • domain: a custom domain name. The domain name must be 1 to 80 characters in length, and can contain only letters, digits, hyphens (-), and periods (.).

Note

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

$SERVER_IP

HealthCheckEnabled

boolean

Indicates whether health checks are enabled. Valid values:

  • true: Enabled.

  • false: Disabled.

true

HealthCheckHttpCode

array

The list of HTTP status codes for successful health checks.

string

The HTTP status code for a successful health check. Multiple status codes are separated by commas (,). Valid values:

  • http_2xx

  • http_3xx

  • http_4xx

  • http_5xx

Default value: http_2xx.

Note

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

http_2xx

HealthCheckInterval

integer

The interval between two consecutive health checks.

Unit: seconds.

Valid values: 1 to 50.

10

HealthCheckPath

string

The health check path.

The path must be 1 to 80 characters in length, and can contain only letters, digits, and the following special characters: -/.%?#&. It must start with a forward slash (/).

Note

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

/test/index.html

HealthCheckProtocol

string

The health check protocol. Valid values:

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

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

TCP

HealthyThreshold

integer

The number of consecutive successful health checks that must occur before the health status of a backend server changes from Failed to Successful.

Valid values: 2 to 10.

2

UnhealthyThreshold

integer

The number of consecutive failed health checks that must occur before the health status of a backend server changes from Successful to Failed.

Valid values: 2 to 10.

2

HealthCheckReq

string

HealthCheckExp

string

Protocol

string

The backend forwarding protocol. Valid values:

  • GENEVE.

GENEVE

RelatedLoadBalancerIds

array

The list of associated load balancing instance IDs.

string

The associated load balancing instance ID.

gwlb-cp6prgqy40hols****

ResourceGroupId

string

The resource group ID.

rg-atstuj3rtop****

Scheduler

string

The scheduling algorithm. Valid values:

  • 5TCH: 5-tuple hash. A consistent hash based on the 5-tuple (source IP address, destination IP address, source port, destination port, and protocol). Requests from the same flow are scheduled to the same backend server.

  • 3TCH: 3-tuple hash. A consistent hash based on the 3-tuple (source IP address, destination IP address, and protocol). Requests from the same flow are scheduled to the same backend server.

  • 2TCH: 2-tuple hash. A consistent hash based on the 2-tuple (source IP address and destination IP address). Requests from the same flow are scheduled to the same backend server.

5TCH

ServerCount

integer

The number of backend servers.

2

ServerGroupId

string

The server group ID.

sgp-atstuj3rtoptyui****

ServerGroupName

string

The server group name.

testServerGroupName

ServerGroupStatus

string

The status of the server group. Valid values:

  • Creating: The server group is being created.

  • Available: The server group is available.

  • Configuring: The server group is being reconfigured.

Available

ServerGroupType

string

The server group type. Valid values:

  • Instance: Server type. This type of server group supports adding Ecs, Eni, and Eci instances.

  • Ip: IP address type. This type of server group supports adding backend servers by IP address.

Instance

ServerFailoverMode

string

The processing mode for existing traffic when a server fails. Valid values:

  • NoRebalance: Existing traffic is not rebalanced.

  • Rebalance: Existing traffic is rebalanced.

NoRebalance

Tags

array<object>

The list of tags.

object

The tag.

Key

string

The tag key. If specified, the value cannot be an empty string. The tag key can be up to 128 characters in length, and cannot start with aliyun or acs:. It cannot contain http:// or https://.

testTagKey

Value

string

The tag value. The tag value can be up to 256 characters in length, and cannot contain http:// or https://.

testTagValue

VpcId

string

The VPC ID.

vpc-bp15zckdt37pq72zv****

TotalCount

integer

The total number of entries.

1

Examples

Success response

JSON format

{
  "MaxResults": 20,
  "NextToken": "FFmyTO70tTpLG6I3FmYAXGKPd****",
  "RequestId": "54B48E3D-DF70-471B-AA93-08E683A1B45",
  "ServerGroups": [
    {
      "ConnectionDrainConfig": {
        "ConnectionDrainEnabled": false,
        "ConnectionDrainTimeout": 300
      },
      "CreateTime": "2024-08-05T18:24:07Z",
      "HealthCheckConfig": {
        "HealthCheckConnectPort": 80,
        "HealthCheckConnectTimeout": 5,
        "HealthCheckDomain": "$SERVER_IP",
        "HealthCheckEnabled": true,
        "HealthCheckHttpCode": [
          "http_2xx"
        ],
        "HealthCheckInterval": 10,
        "HealthCheckPath": "/test/index.html",
        "HealthCheckProtocol": "TCP",
        "HealthyThreshold": 2,
        "UnhealthyThreshold": 2,
        "HealthCheckReq": "",
        "HealthCheckExp": ""
      },
      "Protocol": "GENEVE",
      "RelatedLoadBalancerIds": [
        "gwlb-cp6prgqy40hols****"
      ],
      "ResourceGroupId": "rg-atstuj3rtop****",
      "Scheduler": "5TCH",
      "ServerCount": 2,
      "ServerGroupId": "sgp-atstuj3rtoptyui****",
      "ServerGroupName": "testServerGroupName",
      "ServerGroupStatus": "Available",
      "ServerGroupType": "Instance",
      "ServerFailoverMode": "NoRebalance",
      "Tags": [
        {
          "Key": "testTagKey",
          "Value": "testTagValue"
        }
      ],
      "VpcId": "vpc-bp15zckdt37pq72zv****"
    }
  ],
  "TotalCount": 1
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.