Queries the server groups of Application Load Balancer (ALB) instances.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes ListServerGroups

The operation that you want to perform. Set the value to ListServerGroups.

ServerGroupIds Array of String No sgp-atstuj3rtop****

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

ServerGroupNames Array of String No Group3

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

ResourceGroupId String No rg-atstuj3rtop****

The ID of the resource group.

NextToken String No FFmyTO70tTpLG6I3FmYAXG****

The token that is used for the next query. Valid values:

  • If this is your first query or no next query is to be sent, ignore this parameter.
  • If a next query is to be sent, set the value to the value of NextToken that is returned from the last call.
MaxResults Integer No 20

The maximum number of entries to return. This parameter is optional. Valid values: 1 to 100. If you do not specify a value, the default value 20 is used.

VpcId String No vpc-bp15zckdt37pq72zv****

The ID of the virtual private cloud (VPC).

Tag Array No

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

Key String No Test

The key of the tag.

Value String No Test

The value of the tag.

Response parameters

Parameter Type Example Description
MaxResults Integer 50

The maximum number of entries returned.

NextToken String caeba0bbb2be03f8****

The token that is used for the next query. Valid values:

  • If NextToken is empty, it indicates that no next query is to be sent.
  • If NextToken is not empty, the value indicates the token that is used for the next query.
RequestId String CEF72CEB-54B6-4AE8-B225-F876FF7BA984

The ID of the request.

ServerGroups Array of ServerGroup

The list of server groups.

HealthCheckConfig Object

The health check configurations.

HealthCheckConnectPort Integer 80

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

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

HealthCheckEnabled Boolean true

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

  • true: enabled
  • false: disabled
HealthCheckHost String www.example.com

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 can contain lowercase letters, digits, hyphens (-), and periods (.).
  • It contains at least one period (.) but does not start or end with a period (.).
  • The rightmost domain label of the domain name can contain 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 the HealthCheckProtocol parameter is set to HTTP.
HealthCheckCodes Array of String http_2xx

The HTTP status code for a successful health check. You can specify multiple HTTP status codes.

Valid values: http_2xx, http_3xx, http_4xx, and http_5xx.

Note This parameter takes effect only when the HealthCheckProtocol parameter is set to HTTP.
HealthCheckHttpVersion String HTTP1.1

The HTTP version that is used for health checks.

Valid values: HTTP1.0 and HTTP1.1.

Note This parameter takes effect only when the HealthCheckProtocol parameter is set to HTTP.
HealthCheckInterval Integer 5

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

HealthCheckMethod String HEAD

The HTTP method that is used for health checks.

Valid values: GET and HEAD.

Note This parameter takes effect only when the HealthCheckProtocol parameter is set to HTTP.
HealthCheckPath String /test/index.html

The path that is used for health checks.

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

The protocol that is used for health checks.

Valid values: HTTP and TCP.

HealthCheckTimeout Integer 3

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

HealthyThreshold Integer 4

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.

UnhealthyThreshold Integer 4

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.

Protocol String HTTP

The backend protocol. Valid values:

  • HTTP: allows you to associate an HTTPS, HTTP, or QUIC listener with the server group.
  • HTTPS: allows you to associate an HTTPS listener with the server group.
ResourceGroupId String rg-atstuj3rtop****

The ID of the resource group.

Scheduler String Wrr

The scheduling algorithm. Valid values:

  • Wrr: Backend servers that have higher weights receive more requests than those that have lower weights.
  • Wlc: Requests are distributed based on the weight and number of connections to backend servers. If multiple backend servers have the same weight, requests are forwarded to the backend server with the least connections.
  • Sch: consistent hashing that is based on source IP addresses.
ServerGroupId String sgp-cige6j****

The ID of the server group.

ServerGroupName String Group3

The name of the server group.

ServerGroupStatus String Available

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 configured.
ServerGroupType String Instance

The type of the server group. Valid values:

  • Instance: a server group of the Instance type.
  • Ip: a server group of the IP type.
  • Fc: a server group of the Function type.
StickySessionConfig Object

The configuration of session persistence.

Cookie String B490B5EBF6F3CD402E515D22BCDA****

The cookie that is configured on the backend server.

CookieTimeout Integer 1000

The timeout period of a cookie. Unit: seconds. Valid values: 1 to 86400.

Note This parameter takes effect when the StickySessionEnabled parameter is set to true and the StickySessionType parameter is set to Insert.
StickySessionEnabled Boolean false

Indicates whether session persistence is enabled. Valid values:

  • true: enabled
  • false: disabled
StickySessionType String Insert

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 forwards 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. The next request from the client carries the user-defined cookie, and the listener forwards this request to the recorded backend server.

VpcId String vpc-bp15zckdt37pq72zv****

The ID of the VPC.

Tags Array of Tag

The tags that are added to the server group.

Key String Test

The key of the tag.

Value String Test

The value of the tag.

ConfigManagedEnabled Boolean false

Indicates whether configuration management is enabled. Valid values:

  • true: enabled
  • false: disabled
UpstreamKeepaliveEnabled Boolean false

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

  • true: enabled
  • false: disabled
Ipv6Enabled Boolean false

Indicates whether IPv6 is supported. Valid values:

  • true: supported
  • false: not supported
ServerCount Integer 1

The number of backend servers in the server group.

ServiceName String test

The name of the Kubernetes Service.

TotalCount Integer 1000

The total number of entries returned.

Examples

Sample requests

http(s)://[Endpoint]/?Action=ListServerGroups
&ServerGroupIds=["sgp-atstuj3rtop****"]
&ServerGroupNames=["Group3"]
&ResourceGroupId=rg-atstuj3rtop****
&NextToken=FFmyTO70tTpLG6I3FmYAXG****
&MaxResults=20
&VpcId=vpc-bp15zckdt37pq72zv****
&Tag=[{"Key":"Test","Value":"Test"}]
&Common request parameters

Sample responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<ListServerGroupsResponse>
    <MaxResults>50</MaxResults>
    <NextToken>caeba0bbb2be03f8****</NextToken>
    <RequestId>CEF72CEB-54B6-4AE8-B225-F876FF7BA984</RequestId>
    <ServerGroups>
        <HealthCheckConfig>
            <HealthCheckConnectPort>80</HealthCheckConnectPort>
            <HealthCheckEnabled>true</HealthCheckEnabled>
            <HealthCheckHost>www.example.com</HealthCheckHost>
            <HealthCheckCodes>http_2xx</HealthCheckCodes>
            <HealthCheckHttpVersion>HTTP1.1</HealthCheckHttpVersion>
            <HealthCheckInterval>5</HealthCheckInterval>
            <HealthCheckMethod>HEAD</HealthCheckMethod>
            <HealthCheckPath>/test/index.html</HealthCheckPath>
            <HealthCheckProtocol>HTTP</HealthCheckProtocol>
            <HealthCheckTimeout>3</HealthCheckTimeout>
            <HealthyThreshold>4</HealthyThreshold>
            <UnhealthyThreshold>4</UnhealthyThreshold>
        </HealthCheckConfig>
        <Protocol>HTTP</Protocol>
        <ResourceGroupId>rg-atstuj3rtop****</ResourceGroupId>
        <Scheduler>Wrr</Scheduler>
        <ServerGroupId>sgp-cige6j****</ServerGroupId>
        <ServerGroupName>Group3</ServerGroupName>
        <ServerGroupStatus>Available</ServerGroupStatus>
        <ServerGroupType>Instance</ServerGroupType>
        <StickySessionConfig>
            <Cookie>B490B5EBF6F3CD402E515D22BCDA****</Cookie>
            <CookieTimeout>1000</CookieTimeout>
            <StickySessionEnabled>false</StickySessionEnabled>
            <StickySessionType>Insert</StickySessionType>
        </StickySessionConfig>
        <VpcId>vpc-bp15zckdt37pq72zv****</VpcId>
        <Tags>
            <Key>Test</Key>
            <Value>Test</Value>
        </Tags>
        <ConfigManagedEnabled>false</ConfigManagedEnabled>
        <UpstreamKeepaliveEnabled>false</UpstreamKeepaliveEnabled>
        <Ipv6Enabled>false</Ipv6Enabled>
        <ServerCount>1</ServerCount>
        <ServiceName>test</ServiceName>
    </ServerGroups>
    <TotalCount>1000</TotalCount>
</ListServerGroupsResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "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"
  } ],
  "TotalCount" : 1000
}

Error codes

For a list of error codes, visit the API Error Center.