All Products
Search
Document Center

Server Load Balancer:CreateHealthCheckTemplate

更新時間:Sep 29, 2024

Creates a health check template 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:CreateHealthCheckTemplatecreate
  • HealthCheckTemplate
    acs:alb:{#regionId}:{#accountId}:healthchecktemplate/*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
ClientTokenstringNo

The client token that is used to ensure the idempotence of the request.

You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters.

Note If you do not specify this parameter, the system automatically uses the request ID as the client token. The request ID may be different for each request.
5A2CFF0E-5718-45B5-9D4D-70B3FF3898
HealthCheckTemplateNamestringYes

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
HealthCheckConnectPortintegerNo

The port that is used for health checks.

Valid values: 0 to 65535.

Default value: 0. If you set the value to 0, the port of a backend server is used for health checks.

80
HealthCheckHoststringNo

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

  • $SERVER_IP: the private IP addresses of backend servers. If an IP address is specified, or this parameter is not specified, the ALB instance uses the private IP addresses of backend servers as domain names 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 or HTTPS.
$_ip
HealthCheckCodesarrayNo

The HTTP status codes that indicate a healthy backend server.

stringNo

The HTTP status code that indicates a healthy backend server.

  • If HealthCheckProtocol is set to HTTP or HTTPS, you can set HealthCheckCodes to http_2xx (default), http_3xx, http_4xx, or http_5xx. Separate multiple status codes with commas (,).
  • If HealthCheckProtocol is set to gRPC, the valid values of HealthCheckCodes are from 0 to 99. The default value is 0. Value ranges are supported. You can enter at most 20 value ranges. Separate multiple value ranges with commas (,).
Note This parameter is available only if HealthCheckProtocol is set to HTTP, HTTPS, or gRPC.
http_2xx,http_3xx
HealthCheckIntervalintegerNo

The interval at which health checks are performed.

Valid values: 1 to 50.

Default value: 2.

2
HealthCheckTimeoutintegerNo

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.

Valid values: 1 to 300. Unit: seconds.

Default value: 5.

5
HealthCheckPathstringNo

The URL that is used for health checks.

The URL must be 1 to 80 characters in length, and can contain letters, digits, the following special characters: - / . % ? # &, and the following extended characters: _ ; ~ ! ( ) * [ ] @ $ ^ : ' , +. The URL must start with a forward slash (/).

Note This parameter is available only if HealthCheckProtocol is set to HTTP or HTTPS.
/test/index.html
HealthCheckMethodstringNo

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

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

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

  • HTTP (default): HTTP health checks simulate browser behaviors by sending HEAD or GET requests to probe the availability of backend servers.
  • HTTPS: The ALB instance sends HEAD or GET requests, which simulate browser requests, to check whether the backend server is healthy. 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
HealthCheckHttpVersionstringNo

The HTTP version for health checks.

Valid values: HTTP 1.0 and HTTP 1.1.

Default value: HTTP 1.1.

Note This parameter is available only if HealthCheckProtocol is set to HTTP or HTTPS.
HTTP 1.0
HealthyThresholdintegerNo

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.

Default value: 3.

4
UnhealthyThresholdintegerNo

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.

Default value: 3.

4
DryRunbooleanNo

Specifies whether to perform only a dry run, without performing the actual request. Valid values:

  • true: performs only a dry run. The system checks the request for potential issues, including missing parameter values, incorrect request syntax, and service limits. If the request fails the dry run, an error code is returned. If the request passes the dry run, the DryRunOperation error code is returned.
  • false (default): performs a dry run and performs the actual request. If the request passes the dry run, a 2xx HTTP status code is returned and the operation is performed.
true
Tagarray<object>No

The tags.

objectNo

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 health check template.

HealthCheckTemplateIdstring

The ID of the health check template.

hct-1224334
RequestIdstring

The request ID.

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

Examples

Sample success responses

JSONformat

{
  "HealthCheckTemplateId": "hct-1224334",
  "RequestId": "365F4154-92F6-4AE4-92F8-7FF34B540710"
}

Error codes

HTTP status codeError codeError messageDescription
400QuotaExceeded.HealthCheckTemplatesNumThe quota of %s is exceeded, usage %s/%s.The quota of %s is exceeded. Usage: %s/%s.
403Forbidden.HealthCheckTemplateAuthentication has failed for HealthCheckTemplate.-

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

Change history

Change timeSummary of changesOperation
2024-01-18The Error code has changedView Change Details