Queries the server groups of Network Load Balancer (NLB) instances.
Debugging
Request parameters
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
| Action | String | Yes | ListServerGroups | The operation that you want to perform. Set the value to ListServerGroups. |
| ServerGroupIds.N | String | No | sgp-atstuj3rtoptyui**** | The ID of the server group. You can specify up to 20 server group IDs in each request. |
| ServerGroupNames.N | String | No | NLB_ServerGroup | The names of the server groups to be queried. You can specify up to 20 names in each request. |
| ResourceGroupId | String | No | rg-atstuj3rtop**** | The ID of the resource group to which the server group belongs. |
| ServerGroupType | String | No | Instance | The type of server group. Valid values:
|
| VpcId | String | No | vpc-bp15zckdt37pq72zv**** | The ID of the virtual private cloud (VPC) to which the server group belongs. |
| Tag.N.Key | String | No | Test | 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 |
| Tag.N.Value | String | No | Test | 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 |
| NextToken | String | No | FFmyTO70tTpLG6I3FmYAXGKPd**** | The token that determines the start point of the query. Valid values:
|
| MaxResults | Integer | No | 20 | The number of entries to return on each page. Valid values: 1 to 100. Default value: 20. |
| RegionId | String | No | cn-hangzhou | The ID of the region where the NLB instance is deployed. You can call the DescribeRegions operation to query the most recent region list. |
Response parameters
| Parameter | Type | Example | Description |
|---|---|---|---|
| RequestId | String | 54B28E3D-DF70-471B-AA93-08E683A1B45 | The ID of the request. |
| ServerGroups | Array of ServerGroup | The server groups. |
|
| RegionId | String | cn-hangzhou | The ID of the region where the NLB instance is deployed. |
| ServerGroupId | String | sgp-atstuj3rtoptyui**** | The ID of the server group. |
| ServerGroupName | String | NLB_ServerGroup | The name of the server group. |
| ServerGroupType | String | Instance | The type of server group. Valid values:
|
| AddressIPVersion | String | ipv4 | The protocol version. Valid values:
|
| VpcId | String | vpc-bp15zckdt37pq72zv**** | The ID of the VPC to which the server group belongs. |
| Scheduler | String | Wrr | The scheduling algorithm. Valid values:
|
| Protocol | String | TCP | The protocol used to forward requests to the backend servers. Valid values: TCP, UDP, and TCPSSL. |
| HealthCheck | Object | The configurations of health checks. |
|
| HealthCheckEnabled | Boolean | false | Indicates whether the health check feature is enabled. Valid values:
|
| HealthCheckType | String | TCP | The protocol that is used for health checks. Valid values: TCP and HTTP. |
| HealthCheckConnectPort | Integer | 200 | The backend port that is used for health checks. Valid values: 0 to 65535. A value of 0 indicates that the port on a backend server is used for health checks. |
| HealthyThreshold | Integer | 2 | 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. Valid values: 2 to 10. |
| UnhealthyThreshold | Integer | 3 | 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. Valid values: 2 to 10. |
| HealthCheckConnectTimeout | Integer | 200 | The maximum timeout period of a health check. Unit: seconds. Valid values: 1 to 300. |
| HealthCheckInterval | Integer | 200 | The interval between two consecutive health checks. Unit: seconds. Valid values: 5 to 50. |
| HealthCheckDomain | String | $SERVER_IP | The domain name that is used for health checks. Valid values:
Note This parameter takes effect only if HealthCheckType is set to HTTP. |
| HealthCheckUrl | String | /test/index.html | The path to which health check requests are sent. Note This parameter takes effect only if HealthCheckType is set to HTTP. |
| HealthCheckHttpCode | Array of String | http_2xx | The HTTP status codes returned for health checks. Multiple HTTP status codes are separated by commas (,). Valid values: http_2xx, http_3xx, http_4xx, and http_5xx. Note This parameter takes effect only if HealthCheckType is set to HTTP. |
| HttpCheckMethod | String | GET | The HTTP method that is used for health checks. Valid values: GET and HEAD. Note This parameter takes effect only if HealthCheckType is set to HTTP. |
| ConnectionDrainEnabled | Boolean | false | Indicates whether connection draining is enabled. Valid values:
|
| ConnectionDrainTimeout | Integer | 200 | The timeout period of connection draining. Unit: seconds. Valid values: 10 to 900. |
| PreserveClientIpEnabled | Boolean | true | Indicates whether client IP preservation is enabled. Valid values:
Note Note: If AddressIPVersion is set to ipv4, the default value is true. If AddressIPVersion is set to ipv6, the only valid value is false. true will be supported in later version. |
| AnyPortEnabled | Boolean | false | Indicates whether the feature of forwarding requests to all ports is enabled. Valid values:
|
| ResourceGroupId | String | rg-atstuj3rtop**** | The ID of the resource group to which the server group belongs. |
| ServerGroupStatus | String | Available | The status of the server group. Valid values:
|
| AliUid | Long | 165820696622**** | The UID of the Alibaba Cloud account. |
| Tags | Array of Tag | The tags that are added to the NLB instance. |
|
| Key | String | Test | The tag key. At most 10 tag keys are returned. The tag key can be up to 64 characters in length, and cannot contain |
| Value | String | Test | The tag value. At most 10 tag values are returned. The tag value can be up to 128 characters in length, and cannot contain |
| RelatedLoadBalancerIds | Array of String | nlb-83ckzc8d4xlp8o**** | The NLB instances. |
| ServerCount | Integer | 2 | The number of server groups associated with the NLB instances. |
| TotalCount | Integer | 1 | The number of entries returned. |
| NextToken | String | FFmyTO70tTpLG6I3FmYAXGKPd**** | The token that determines the start point of the query. Valid values:
|
| MaxResults | Integer | 20 | The number of entries returned per page. Valid values: 1 to 100. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=ListServerGroups
&ServerGroupIds=["sgp-atstuj3rtoptyui****"]
&ServerGroupNames=["NLB_ServerGroup"]
&ResourceGroupId=rg-atstuj3rtop****
&ServerGroupType=Instance
&VpcId=vpc-bp15zckdt37pq72zv****
&Tag=[{"Key":"Test","Value":"Test"}]
&NextToken=FFmyTO70tTpLG6I3FmYAXGKPd****
&MaxResults=20
&RegionId=cn-hangzhou
&Common request parameters
Sample success responses
XML format
HTTP/1.1 200 OK
Content-Type:application/xml
<ListServerGroupsResponse>
<RequestId>54B28E3D-DF70-471B-AA93-08E683A1B45</RequestId>
<ServerGroups>
<RegionId>cn-hangzhou</RegionId>
<ServerGroupId>sgp-atstuj3rtoptyui****</ServerGroupId>
<ServerGroupName>NLB_ServerGroup</ServerGroupName>
<ServerGroupType>Instance</ServerGroupType>
<AddressIPVersion>ipv4</AddressIPVersion>
<VpcId>vpc-bp15zckdt37pq72zv****</VpcId>
<Scheduler>Wrr</Scheduler>
<Protocol>TCP</Protocol>
<HealthCheck>
<HealthCheckEnabled>false</HealthCheckEnabled>
<HealthCheckType>TCP</HealthCheckType>
<HealthCheckConnectPort>200</HealthCheckConnectPort>
<HealthyThreshold>2</HealthyThreshold>
<UnhealthyThreshold>3</UnhealthyThreshold>
<HealthCheckConnectTimeout>200</HealthCheckConnectTimeout>
<HealthCheckInterval>200</HealthCheckInterval>
<HealthCheckDomain>$SERVER_IP</HealthCheckDomain>
<HealthCheckUrl>/test/index.html</HealthCheckUrl>
<HealthCheckHttpCode>http2xx</HealthCheckHttpCode>
<HttpCheckMethod>GET</HttpCheckMethod>
</HealthCheck>
<ConnectionDrainEnabled>false</ConnectionDrainEnabled>
<ConnectionDrainTimeout>200</ConnectionDrainTimeout>
<PreserveClientIpEnabled>true</PreserveClientIpEnabled>
<AnyPortEnabled>false</AnyPortEnabled>
<ResourceGroupId>rg-atstuj3rtop****</ResourceGroupId>
<ServerGroupStatus>Available</ServerGroupStatus>
<Tags>
<Key>Test</Key>
<Value>Test</Value>
</Tags>
<RelatedLoadBalancerIds>nlb-83ckzc8d4xlp8o****</RelatedLoadBalancerIds>
<ServerCount>2</ServerCount>
</ServerGroups>
<TotalCount>1</TotalCount>
<NextToken>FFmyTO70tTpLG6I3FmYAXGKPd****</NextToken>
<MaxResults>20</MaxResults>
</ListServerGroupsResponse>
JSON format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "54B28E3D-DF70-471B-AA93-08E683A1B45",
"ServerGroups" : [ {
"RegionId" : "cn-hangzhou",
"ServerGroupId" : "sgp-atstuj3rtoptyui****",
"ServerGroupName" : "NLB_ServerGroup",
"ServerGroupType" : "Instance",
"AddressIPVersion" : "ipv4",
"VpcId" : "vpc-bp15zckdt37pq72zv****",
"Scheduler" : "Wrr",
"Protocol" : "TCP",
"HealthCheck" : {
"HealthCheckEnabled" : false,
"HealthCheckType" : "TCP",
"HealthCheckConnectPort" : 200,
"HealthyThreshold" : 2,
"UnhealthyThreshold" : 3,
"HealthCheckConnectTimeout" : 200,
"HealthCheckInterval" : 200,
"HealthCheckDomain" : "$SERVER_IP",
"HealthCheckUrl" : "/test/index.html",
"HealthCheckHttpCode" : [ "http2xx" ],
"HttpCheckMethod" : "GET"
},
"ConnectionDrainEnabled" : false,
"ConnectionDrainTimeout" : 200,
"PreserveClientIpEnabled" : true,
"AnyPortEnabled" : false,
"ResourceGroupId" : "rg-atstuj3rtop****",
"ServerGroupStatus" : "Available",
"Tags" : [ {
"Key" : "Test",
"Value" : "Test"
} ],
"RelatedLoadBalancerIds" : [ "nlb-83ckzc8d4xlp8o****" ],
"ServerCount" : 2
} ],
"TotalCount" : 1,
"NextToken" : "FFmyTO70tTpLG6I3FmYAXGKPd****",
"MaxResults" : 20
}
Error codes
For a list of error codes, see Service error codes.