You can configure health checks to monitor the conditions of server groups. This helps you evaluate the availability of the backend servers in the server groups. This topic describes how to create, modify, and delete a health check.
Background information
ALB instances distribute requests to healthy backend servers in active zones. If a backend server is declared unhealthy, the ALB instance stops distributing requests to the backend server, and distributes the requests to healthy backend servers. When an unhealthy backend server is declared healthy again, the ALB instance resumes distributing requests to the backend server. 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 due to network jitter. After a health check is complete, ALB closes the connection for the health check.
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 parameters described in the following table and click Create. If network traffic is frequently switched between backend servers, the availability of your workloads may be affected. We recommend that you use the default settings when you configure health checks.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.
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.
- 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.
Note This parameter takes effect only when the health check protocol is set to HTTP or gRPC.HTTP Version Select an HTTP version. Valid values: HTTP1.0 and HTTP1.1. Note This parameter takes effect only when the health check protocol is set to HTTP.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. To use a specified port for health checks, enter a port number. Valid values: 1 to 65535.
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. To use a specified domain name for health checks, enter a domain name.
Health Check Status Codes Specify the status codes that are returned when backend servers pass health checks. A backend server is considered healthy only when the ALB request is sent and the specified status code is returned. - When the health check protocol is set to HTTP, the valid values are http_2xx, http_3xx, http_4xx, and http_5xx. By default, http_2xx and http_3xx are selected.
- When 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 (,).
Note This parameter takes effect only when the health check protocol is set to HTTP 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.
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, set 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 Health Check page. to view the health check template on the
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 health check parameters based on your business requirements and click Save. Warning
- After 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. Warning
- After 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 manage and click Delete in the Actions column.
- In the Delete message, confirm the information and click OK.