All Products
Search
Document Center

Server Load Balancer:Health checks

Last Updated:Jul 25, 2024

To monitor the availability of backend servers for Application Load Balancer (ALB), you can configure health checks for the server groups of the ALB. Health checks ensure service availability by detecting unhealthy backend servers at the earliest opportunity. This topic describes how to create, modify, and delete a health check.

Background information

ALB allows you to configure health checks for server groups. By default, health checks are enabled for all server groups.

  • When health checks are enabled, ALB automatically routes requests to healthy backend servers and probes the availability of all backend servers at a specified interval. A backend server must pass health checks for a specific number of times (N times) before the backend server 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 for a specific number of times, the backend server is declared unhealthy. In this case, ALB automatically stops distributing requests to the backend server.

    • 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 completed.

Note

Health checks are not performed on backend servers whose weights are 0.

Limits on HTTPS health checks

Standard and WAF-enabled ALB instances support 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

  1. Log on to the ALB console.
  2. In the top navigation bar, select the region in which you want to create a health check.

  3. In the left-side navigation pane, choose ALB > Health Check.

  4. On the Health Check page, click Create Health Check.

  5. In the Create Health Check dialog box, configure the parameters that are described in the following table, and click Create.

    When you configure a health check, we recommend that you use the default values to prevent 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 that is used to perform health checks. Valid values:

    • HTTP: To perform HTTP health checks, ALB sends 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 the Limits on HTTPS health checks section of this topic.

    • 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

    Select a health check method. Valid values:

    • 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.

    Note
    • This 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.

    Note

    This parameter takes effect only if the health check protocol is HTTP or HTTPS.

    Port Number

    Enter the port that ALB uses to perform health checks on backend servers.

    By default, this parameter is empty, which indicates that the port selected by 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, ALB performs HTTP health checks by sending HTTP HEAD requests to the private IP address of a backend Elastic Compute Service (ECS) instance to visit the default homepage configured on the ECS instance. If you do not want to use the default homepage for health checks, you can specify a URL.

    Domain Name

    Enter a 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 the status codes that indicate healthy backend servers. An ALB backend server passes health checks only if the backend server returns the specified status codes for health check requests.

    • If the health check protocol is HTTP or HTTPS, you can select http_2xx, http_3xx, http_4xx, and http_5xx. By default, http_2xx and http_3xx are selected.

    • If the health check protocol is gRPC, the valid values are 0 to 99. Value ranges are supported. You can enter up to 20 value ranges that are separated with commas (,).

    Note

    This parameter takes effect only if the health check protocol is HTTP, HTTPS, or gRPC.

    Health Check Response Timeout

    Specify a 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 the backend server 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 the backend server is declared unhealthy.

    Valid values: 2 to 10. Default value: 3.

    Tag

    Configure the Tag Key and Tag Value parameters.

    After you specify tags, you can filter health checks by tag on the Health Check page.

    After a health check is created, you can select the health check in the Health Check Settings section when you create an ALB server group. For more information, see Create and manage 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.

  1. Log on to the ALB console.
  2. In the top navigation bar, select the region where you want to create a server group.

  3. In the left-side navigation pane, choose ALB > Server Groups.

  4. On the Server Groups page, click Create Server Group.

  5. In the Create Server Group dialog box, configure the 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 Health Check Settings. After you configure the health check settings, select Save the health check configurations as a template, which can facilitate health check creation and configurations., and enter a health check name.

  6. Optional. In the left-side navigation pane of the console, choose ALB > Health Check. On the Health Check page, view the saved health check template.

Modify a health check

Method 1: Modify a health check on the Health Check page

  1. Log on to the ALB console.
  2. In the top navigation bar, select the region in which you want to create a health check.

  3. In the left-side navigation pane, choose ALB > Health Check.

  4. On the Health Check page, find the health check that you want to manage and click Modify in the Actions column.

  5. In the Modify Health Check Settings dialog box, modify the parameters based on your business requirements and click Save.

    Warning
    • After health checks are disabled, ALB no longer checks the health status of the backend servers. If a backend server is down, network 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

  1. Log on to the ALB console.
  2. In the top navigation bar, select the region where you want to create a server group.

  3. In the left-side navigation pane, choose ALB > Server Groups.

  4. On the Server Groups page, find the server group that you want to manage and click Modify Health Check in the Actions column.

  5. In the Modify Health Check dialog box, turn on or off Health Check. You can also click Modify next to Health Check Settings to modify the health check configurations.

    Warning
    • After health checks are disabled, ALB no longer checks the health status of the backend servers. If a backend server is down, network 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.

View health check results

If a listener is configured for your ALB instance, and health checks are enabled for the backend server groups, you can view the health check results on the Listener tab.

  1. Log on to the ALB console.
  2. In the top navigation bar, select the region where the ALB instance is deployed.

  3. On the Instances page, click the ID of the ALB instance that you want to manage.

  4. Click the Listener tab, and view the health check results of backend servers in the Health Check Status column.

    image.png

Delete a health check

  1. Log on to the ALB console.
  2. In the top navigation bar, select the region in which you want to create a health check.

  3. In the left-side navigation pane, choose ALB > Health Check.

  4. On the Health Check page, find the health check that you want to delete and click Delete in the Actions column.

  5. In the Delete message, confirm the information and click OK.

FAQ