All Products
Search
Document Center

Server Load Balancer:ListHealthCheckTemplates

Last Updated:Mar 01, 2024

Queries health check templates in a region.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
alb:ListHealthCheckTemplatesList
  • HealthCheckTemplate
    acs:alb:{#regionId}:{#accountId}:healthchecktemplate/*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
NextTokenstringNo

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.
  • You must specify the token that is obtained from the previous query as the value of NextToken.
FFmyTO70tTpLG6I3FmYAXGKPd****
MaxResultsintegerNo

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

50
HealthCheckTemplateIdsarrayNo

The IDs of health check templates.

stringNo

The IDs of health check templates. You can specify up to 20 IDs in each call. The results are filtered based on the specified IDs.

hct-bp1qjwo61pqz3ahltv****
HealthCheckTemplateNamesarrayNo

The health check templates.

stringNo

The names of health check templates. You can specify up to 10 names in each call. The results are filtered based on the specified names.

test
Tagobject []No

The tags.

KeystringNo

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

env
ValuestringNo

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

product

Response parameters

ParameterTypeDescriptionExample
object

The information about the health check template.

HealthCheckTemplatesobject []

The health check templates.

HealthCheckConnectPortinteger

The port that is used for health checks.

Valid values: ** 0 to 65535**.

Default value: 0. This value indicates that the port on a backend server is used for health checks.

80
HealthCheckHoststring

The domain name that is used for health checks. Valid values:

$SERVER_IP (default): the private IP addresses of backend servers. If HealthCheckHost is not specified or set to $SERVER_IP, SLB uses the private IP addresses of backend servers for health checks.

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

Note This parameter takes effect only if HealthCheckProtocol is set to HTTP.
$_ip
HealthCheckCodesarray

The HTTP status codes.

string

The HTTP status code that is used to determine whether the backend server passes the health check.

  • If HealthCheckProtocol is set to HTTP, HealthCheckCodes can be set to http_2xx (default), http_3xx, http_4xx, and http_5xx. Multiple HTTP status codes are separated with commas (,).
  • If HealthCheckProtocol is set to gRPC, HealthCheckCodes can be set to 0 to 99. Default value: 0. Up to 20 value ranges are supported and value ranges are separated with commas (,).
Note This parameter is returned only if HealthCheckProtocol is set to HTTP or gRPC.
http_2xx,http_3xx
HealthCheckHttpVersionstring

The HTTP version that is used for health checks.

Valid values: HTTP 1.0 and HTTP 1.1.

Default value: HTTP 1.1.

Note This parameter takes effect only if HealthCheckProtocol is set to HTTP.
HTTP 1.0
HealthCheckIntervalinteger

The interval at which health checks are performed. Unit: seconds. Valid values: 1 to 50. Default value: 2.

5
HealthCheckMethodstring

The HTTP method that is used for health checks. Valid values:

  • HEAD (default): By default, HTTP health checks use the HEAD method.
  • GET: If the length of a response exceeds 8 KB, the response is truncated. However, the health check result is not affected.
  • POST: By default, gRPC health checks use the POST method.
Note This parameter takes effect only if HealthCheckProtocol is set to HTTP or gRPC.
HEAD
HealthCheckPathstring

The URL that is used for health checks.

The URL must be 1 to 80 characters in length and can contain only letters, digits, hyphens (-), forward slashes (/), periods (.), percent signs (%), question marks (?), number signs (#), and ampersands (&). The URL can also contain the following extended characters: _ ; ~ ! ( ) * [ ] @ $ ^ : ' , +. The URL must start with a forward slash (/).

/test/index.html
HealthCheckProtocolstring

The protocol that is used for health checks. Valid values:

  • HTTP (default): The SLB instance sends HEAD or GET requests to a backend server to simulate access from a browser and check whether the backend server is healthy.
  • TCP: To perform TCP health checks, SLB sends SYN packets to the backend server to check whether the port of the backend server is available to receive requests.
  • gRPC: To perform gRPC health checks, SLB sends POST or GET requests to a backend server to check whether the backend server is healthy.
HTTP
HealthCheckTemplateIdstring

The ID of the health check template.

hct-bp1qjwo61pqz3ahltv****
HealthCheckTemplateNamestring

The name of the health check template.

The name must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter.

HealthCheckTemplate1
HealthCheckTimeoutinteger

The timeout period for a health check response. If a backend Elastic Compute Service (ECS) instance does not return a health check response within the specified timeout period, the backend server fails the health check.

Valid values: 1 to 300. Unit: seconds.

Default value: 5.

Note If the value of HealthCHeckTimeout is smaller than the value of HealthCheckInterval, the value of HealthCHeckTimeout is ignored and the value of HealthCheckInterval is used.
3
HealthyThresholdinteger

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 changes from fail to success.

Valid values: 2 to 10.

Default value: 3.

4
UnhealthyThresholdinteger

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 changes from success to fail.

Valid values: 2 to 10.

Default value: 3.

4
Tagsobject []

The tags.

Keystring

The tag key.

env
Valuestring

The tag value.

product
MaxResultsinteger

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

50
NextTokenstring

The returned value of NextToken is a pagination token, which can be used in the next request to retrieve a new page of results. Valid values:

  • If NextToken is empty, no next page exists.
  • If a value of NextToken was returned in the previous query, specify the value to obtain the next set of results.
FFmyTO70tTpLG6I3FmYAXGKPd****
RequestIdstring

The request ID.

365F4154-92F6-4AE4-92F8-7FF34B540710
TotalCountinteger

The total number of entries returned.

1000

Examples

Sample success responses

JSONformat

{
  "HealthCheckTemplates": [
    {
      "HealthCheckConnectPort": 80,
      "HealthCheckHost": "$_ip",
      "HealthCheckCodes": [
        "http_2xx,http_3xx"
      ],
      "HealthCheckHttpVersion": "HTTP 1.0",
      "HealthCheckInterval": 5,
      "HealthCheckMethod": "HEAD",
      "HealthCheckPath": "/test/index.html",
      "HealthCheckProtocol": "HTTP",
      "HealthCheckTemplateId": "hct-bp1qjwo61pqz3ahltv****",
      "HealthCheckTemplateName": "HealthCheckTemplate1",
      "HealthCheckTimeout": 3,
      "HealthyThreshold": 4,
      "UnhealthyThreshold": 4,
      "Tags": [
        {
          "Key": "env",
          "Value": "product"
        }
      ]
    }
  ],
  "MaxResults": 50,
  "NextToken": "FFmyTO70tTpLG6I3FmYAXGKPd****",
  "RequestId": "365F4154-92F6-4AE4-92F8-7FF34B540710",
  "TotalCount": 1000
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-01-17The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Added Error Codes: 403