All Products
Search
Document Center

Server Load Balancer:ListServerGroups

Last Updated:Jun 10, 2026

Mengambil daftar kelompok server.

Coba sekarang

Coba API ini di OpenAPI Explorer tanpa perlu penandatanganan manual. Panggilan yang berhasil akan secara otomatis menghasilkan contoh kode SDK sesuai dengan parameter Anda. Unduh kode tersebut dengan kredensial bawaan yang aman untuk penggunaan lokal.

Test

RAM authorization

Tabel berikut menjelaskan otorisasi yang diperlukan untuk memanggil API ini. Anda dapat menentukannya dalam kebijakan Resource Access Management (RAM). Kolom pada tabel dijelaskan sebagai berikut:

  • Action: Aksi yang dapat digunakan dalam elemen Action pada pernyataan kebijakan izin RAM untuk memberikan izin guna melakukan operasi tersebut.

  • API: API yang dapat Anda panggil untuk melakukan aksi tersebut.

  • Access level: Tingkat akses yang telah ditentukan untuk setiap API. Nilai yang valid: create, list, get, update, dan delete.

  • Resource type: Jenis resource yang mendukung otorisasi untuk melakukan aksi tersebut. Ini menunjukkan apakah aksi tersebut mendukung izin tingkat resource. Resource yang ditentukan harus kompatibel dengan aksi tersebut. Jika tidak, kebijakan tersebut tidak akan berlaku.

    • Untuk API dengan izin tingkat resource, jenis resource yang diperlukan ditandai dengan tanda bintang (*). Tentukan Nama Sumber Daya Alibaba Cloud (ARN) yang sesuai dalam elemen Resource pada kebijakan.

    • Untuk API tanpa izin tingkat resource, ditampilkan sebagai All Resources. Gunakan tanda bintang (*) dalam elemen Resource pada kebijakan.

  • Condition key: Kunci kondisi yang didefinisikan oleh layanan. Kunci ini memungkinkan kontrol granular, berlaku baik hanya untuk aksi maupun untuk aksi yang terkait dengan resource tertentu. Selain kunci kondisi spesifik layanan, Alibaba Cloud menyediakan serangkaian common condition keys yang berlaku di semua layanan yang didukung RAM.

  • Dependent action: Aksi dependen yang diperlukan untuk menjalankan aksi tersebut. Untuk menyelesaikan aksi tersebut, pengguna RAM atau role RAM harus memiliki izin untuk melakukan semua aksi dependen.

Action

Access level

Resource type

Condition key

Dependent action

alb:ListServerGroups

get

*ServerGroup

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

None None

Parameter permintaan

Parameter

Type

Required

Description

Example

ServerGroupIds

array

No

ID kelompok server. Anda dapat menentukan hingga 20 ID dalam satu permintaan.

string

No

The server group ID.

sgp-atstuj3rtop****

ServerGroupNames

array

No

Nama kelompok server. Anda dapat menentukan hingga 10 nama dalam satu permintaan.

string

No

The server group name.

Group3

ResourceGroupId

string

No

ID kelompok sumber daya.

rg-atstuj3rtop****

NextToken

string

No

Token yang digunakan untuk kueri berikutnya.

  • Jika ini adalah kueri pertama Anda atau tidak ada kueri berikutnya yang akan dikirim, Anda dapat mengosongkan parameter ini.

  • Jika kueri berikutnya akan dikirim, atur parameter ini ke nilai NextToken dari tanggapan API sebelumnya.

FFmyTO70tTpLG6I3FmYAXG****

MaxResults

integer

No

Jumlah entri yang ditampilkan pada setiap halaman. Nilai valid: 1 hingga 100. Nilai default: 20.

20

VpcId

string

No

ID virtual private cloud (VPC).

vpc-bp15zckdt37pq72zv****

ServerGroupType

string

No

Tipe kelompok server. Nilai valid:

  • Instance: memungkinkan Anda menambahkan server tipe ECS, ENI, dan ECI.

  • Ip: memungkinkan Anda menambahkan server dengan alamat IP tertentu.

  • Fc: memungkinkan Anda menambahkan fungsi Function Compute sebagai server backend.

  • Jika Anda tidak menentukan parameter ini, sistem mengkueri kelompok server dari semua tipe.

Instance

Tag

array<object>

No

Tag. Anda dapat menentukan hingga 10 tag dalam satu permintaan.

Instance

object

No

A tag that consists of a key-value pair.

Key

string

No

The tag key.

The tag key can be up to 128 characters in length. It cannot start with aliyun or acs:, and it cannot contain http:// or https://.

Test

Value

string

No

The tag value.

The tag value can be up to 128 characters in length. It cannot start with aliyun or acs:, and it cannot contain http:// or https://.

Test

Elemen respons

Element

Type

Description

Example

object

The data structure that is returned.

MaxResults

integer

The number of entries returned per page.

50

NextToken

string

The token used to retrieve the next page of results. Valid values:

  • If NextToken is empty, no more results are available.

  • If a value is returned, use it to retrieve the next page of results.

caeba0bbb2be03f8****

RequestId

string

The request ID.

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

ServerGroups

array<object>

The list of server groups.

array<object>

The list of server groups.

HealthCheckConfig

object

The health check configuration.

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 (-).

Catatan

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 (,).

Catatan

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.

Catatan

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.

Catatan

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.

Catatan

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: 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 load balancer instances.

string

The ID of the associated load balancer 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 receive more requests.

  • Wlc: weighted least connections. The load balancer considers both the weight and the number of active connections for each backend server. If weights are the same, the backend server with the fewest active connections is selected.

  • Sch: consistent hashing. Requests with the same hash key are routed to the same backend server. By default, the hash key is the source IP address. If UchConfig is configured, the hash key is a URL parameter.

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: The server group is being created.

  • Available: The server group is available.

  • Configuring: The server group is being updated.

Available

ServerGroupType

string

The type of the server group. Valid values:

  • Instance: an instance-type server group to which you can add ECS instances, elastic network interfaces (ENIs), and ECI instances.

  • IP: an IP-based server group.

  • Function Compute: a Function Compute-based server group.

Instance

StickySessionConfig

object

The sticky session configuration.

Cookie

string

The cookie configured for the server.

B490B5EBF6F3CD402E515D22BCDA****

CookieTimeout

integer

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

Catatan

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.

vpc-bp15zckdt37pq72zv****

Tags

array<object>

The list of tags that are associated with the server group.

object

The list of tags that are associated with the server group.

Key

string

The tag key.

Test

Value

string

The tag value.

Test

ConfigManagedEnabled

boolean

Specifies whether to enable configuration management. Valid values:

  • true: Enabled.

  • false: Disabled.

false

UpstreamKeepaliveEnabled

boolean

Specifies whether to enable backend keep-alive connections. Valid values:

  • true: Enabled.

  • false: Disabled.

false

Ipv6Enabled

boolean

Specifies whether IPv6 is enabled. Valid values:

  • true: Enabled.

  • false: Disabled.

false

ServerCount

integer

The number of backend servers in the server group.

1

ServiceName

string

The service name.

test

UchConfig

object

The configuration of URL-based consistent hashing.

Type

string

The parameter type. Valid value: QueryString.

QueryString

Value

string

The hash value.

abc

CreateTime

string

The time when the server group was created.

2022-07-02T02:49:05Z

ConnectionDrainConfig

object

The connection draining configuration.

If you enable connection draining, the load balancer allows existing connections to be processed within a specified period of time after a backend server is removed or fails a health check.

Catatan
  • A basic instance does not support connection draining. Only standard instances and WAF-enabled instances support this feature.

  • Connection draining is supported by instance and IP-based server groups, but not by Function Compute-based server groups.

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 slow start configuration.

After you enable slow start, the load balancer warms up newly added backend servers for a specified period of time. The number of requests that are routed to these servers increases linearly during the warm-up period.

Catatan
  • A basic instance does not support slow start. Only standard instances and WAF-enabled instances support this feature.

  • Instance and IP-based server groups support slow start. Function Compute-based server groups do not.

  • You can enable slow start only when the scheduling algorithm is weighted round robin.

SlowStartEnabled

boolean

Indicates whether slow starts are enabled. Valid values:

  • true

  • false

false

SlowStartDuration

integer

The duration of a slow start.

30

CrossZoneEnabled

boolean

Specifies whether to enable cross-zone load balancing for the server group. Valid values:

  • true: Enabled. (Default)

  • false: Disabled.

true

IpVersionAffinityMode

string

Affinity

TotalCount

integer

The total number of entries.

1000

Contoh

Respons sukses

JSONformat

{
  "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
}

Kode kesalahan

Lihat Error Codes untuk daftar lengkap.

Catatan rilis

Lihat Release Notes untuk daftar lengkap.