You can configure health checks to check the status of server groups and the availability of servers. This topic describes how to create, modify, and delete a health check.
Background information
Application Load Balancer (ALB) allows you to configure health checks based on server groups. By default, health checks are enabled for all server groups. If health checks are enabled for a server group, ALB routes client requests only to healthy servers in the server group and continuously monitors the status of all backend servers in the server group.
A server must pass health checks for a specified number of times (N times) before it is declared healthy. You can specify N based on your business requirements. This prevents health check errors caused by network jitter.
If a backend server fails health checks, ALB automatically distributes requests to healthy backend servers.
After the backend server recovers, ALB automatically distributes requests to the backend server.
Health checks use non-persistent connections. The connections are closed after health checks are complete.
Limits on HTTPS health checks
By default, HTTPS health checks are unavailable for ALB instances. To use HTTPS health checks, log on to the Quota Center console, go to the Privileges page, enter the quota ID
slb_user_visible_gray_label/https_health_check
, and then apply for the quota. For more information, see Manage ALB quotas.ALB instances in the China (Hong Kong), China (Nanjing - Local Region), and China (Fuzhou - Local Region) regions do not support HTTPS health checks.
Basic ALB instances do not support HTTPS health checks.
Create a health check
Method 1: Create a health check on the Health Check page
- Log on to the ALB console.
In the top navigation bar, select the region where you want to create a health check.
In the left-side navigation pane, choose .
On the Health Check page, click Create Health Check.
In the Create Health Check dialog box, set the following parameters and click Create.
When you configure a health check, we recommend that you use the default values to avoid frequent switchovers caused by health check failures. This reduces the adverse impact on system availability.
Parameter
Description
Health Check Name
Enter a name for the health check.
Protocol
Select the protocol of the health check. Valid values:
HTTP: ALB performs HTTP health checks by sending HEAD or GET requests to a backend server to check whether the backend server is healthy.
HTTPS: ALB performs HTTPS health checks by sending HEAD or GET requests to a backend server to check whether the backend server is healthy. For more information, see Limits on HTTPS health checks.
TCP: ALB performs TCP health checks by sending SYN packets to a backend server to check whether the port of the backend server is available to receive requests.
gRPC: ALB performs gRPC health checks by sending POST or GET requests to a backend server to check whether the backend server is healthy.
Health Check Method
Specify a health check method.
HEAD: By default, HTTP health checks use the HEAD method. Make sure that your backend servers support HEAD requests. If your backend servers do not support the HEAD method or the HEAD method is disabled, the health check may fail. In this case, you can use the GET method.
POST: By default, gRPC health checks use the POST method. Make sure that your backend servers support POST requests. If your backend servers do not support the POST method or the POST method is disabled, the health check may fail. In this case, you can use the GET method.
GET: If the size of a response exceeds 8 KB, the response is truncated. However, the health check result is not affected.
NoteThis parameter takes effect only if the health check protocol is HTTP, HTTPS, or gRPC.
HTTP and HTTPS health checks support the HEAD and GET health check methods. gRPC health checks support the POST and GET health check methods.
HTTP Version
Select an HTTP version. Valid values: HTTP1.0 and HTTP1.1.
NoteThis parameter takes effect only if the health check protocol is HTTP or HTTPS.
Port
Specify the port that ALB uses to perform health checks on backend servers.
The parameter is empty by default. This value indicates that the port of a backend server is used for health checks. If you want to specify a specific port for health checks, enter a port number. Valid values: 1 to 65535. You can enter only one port number.
Path
Enter the URL of the web page based on which you want to perform health checks. We recommend that you enter the URL of a static web page.
By default, when ALB performs HTTP health checks, it tests the default homepage configured on a backend Elastic Compute Service (ECS) instance by sending HTTP HEAD requests to the private IP address of the ECS instance. If you do not want to use the default homepage for health checks, you can specify a URL.
Domain Name
Enter the domain name that is used for health checks.
By default, ALB uses the private IP addresses of backend servers for health checks. You can also specify a domain name.
Health Check Status Codes
Select one or more HTTP status codes. The specified HTTP status codes are used to indicate that an ALB backend server passes a health check.
If the health check protocol is set to HTTP or HTTPS, you can select http_2xx, http_3xx, http_4xx, and http_5xx. http_2xx and http_3xx are selected by default.
If the health check protocol is set to gRPC, the valid values are 0 to 99. Value ranges are supported. You can enter up to 20 value ranges and must separate each range with a comma (,).
NoteThis parameter takes effect only if the health check protocol is HTTP, HTTPS, or gRPC.
Health Check Response Timeout
Specify the timeout period for a health check response. If a backend server does not return a health check response within the specified timeout period, the server fails the health check.
Valid values: 1 to 300. Default value: 5. Unit: seconds.
Health Check Interval
Specify the interval between two consecutive health checks.
Valid values: 1 to 50. Default value: 2. Unit: seconds.
Healthy Threshold
Specify the number of times for which an unhealthy backend server must consecutively pass health checks before it is declared healthy.
Valid values: 2 to 10. Default value: 3.
Unhealthy Threshold
Specify the number of times for which a healthy backend server must consecutively fail health checks before it is declared unhealthy.
Valid values: 2 to 10. Default value: 3.
After a health check is created, you can select the health check in the Advanced Settings section when you create an ALB server group. For more information, see Create a server group.
Method 2: Create a health check on the Server Groups page
When you create a server group, you can save the configurations of a health check as a health check template. This way, you can apply the template when you create a health check.
- Log on to the ALB console.
In the top navigation bar, select the region where the server group is deployed.
In the left-side navigation pane, choose .
On the Server Groups page, click Create Server Group.
In the Create Server Group dialog box, configure the following parameters and click Create.
This section describes only the parameters that are relevant to this topic. For more information about other parameters, see Create and manage a server group.
Click Modify next to Advanced Settings. After you set the health check parameters, select Save Configuration as Template and set the Health Check Name parameter.
Optional:You can choose to view the saved health check template on the Health Check page.
Modify a health check
Method 1: Modify a health check on the Health Check page
- Log on to the ALB console.
In the top navigation bar, select the region where you want to create a health check.
In the left-side navigation pane, choose .
On the Health Check page, find the health check that you want to manage and click Edit in the Actions column.
In the Modify Health Check Settings dialog box, modify the parameters and click Save.
WarningAfter health checks are disabled, ALB no longer checks the backend servers. If a backend server fails, traffic cannot be automatically switched to healthy backend servers.
If you specify a longer health check interval, more time is required for ALB to detect unhealthy backend servers.
Method 2: Modify a health check on the Server Groups page
- Log on to the ALB console.
In the top navigation bar, select the region where the server group is deployed.
In the left-side navigation pane, choose .
On the Server Groups page, find the server group that you want to manage and click Modify Health Check in the Actions column.
In the Modify Health Check dialog box, enable or disable the health check, or click Modify next to Advanced Settings to modify the health check parameters.
WarningAfter health checks are disabled, ALB no longer checks the backend servers. If a backend server fails, traffic cannot be automatically switched to healthy backend servers.
If you specify a longer health check interval, more time is required for ALB to detect unhealthy backend servers.
Delete a health check
- Log on to the ALB console.
In the top navigation bar, select the region where you want to create a health check.
In the left-side navigation pane, choose .
On the Health Check page, find the health check that you want to delete and click Delete in the Actions column.
In the Delete message, confirm the information and click OK.