ELB Health Check Tutorial

ELB Health Check Tutorial

Amazon Elastic Load Balancing (ELB) is one of the most widely used network and application load balancers in the world that many enterprises use to route application traffic. However, in order to get the most out of it, you need to know how to run ELB health checks. In this article, we’re going to take a look at what health checks are, how to configure them, and some ELB monitoring software you can use.

What is Amazon ELB 

Amazon ELB is Amazon’s elastic load balancing solution that automatically distributes application traffic across multiple Amazon EC2 instances. ELB provides a solution for adding fault tolerance to applications and for routing application traffic more efficiently. The solution is made up of three load balancers:

  • Classic Load Balancer (CLB) – Past generation’s load balancer that operates at the request/connection level and provides load balancing across multiple EC2 instances. Used by applications built within the EC2-classic network.
  • Application Load Balancer (ALB) – Load balancer that operates at the individual request level and routes traffic to targets within Amazon Virtual Private Cloud (VPC). Often used for balancing HTTP and HTTPS traffic.
  • Network Load Balancer (NLB) – Load balancer that operates at the connection level that routes traffic within Amazon VPC. Can handle high volumes of traffic and is often used to balance TCP and UDP traffic.

What is an ELB Health Check?

AWS uses ELB health checks to measure the availability of EC2 instances. The load balancer periodically sends requests to instances to check if they’re classified as healthy. Healthy instances will respond to requests with a 200 response code within the default health check interval of 30 seconds.

Instances that fail to respond to a certain number of consecutive requests will be classified as unhealthy and marked as OutOfService. In short, you can use health checks to see how many instances are up or down.

Why do Instances Fail ELB Health Checks? 

There are many reasons why an instance would fail a health check, and many of them are due to misconfigurations. We’ve listed below some of the most common reasons why instances fail health checks:

  • Health check target page error – A HTTP GET request receives a non-200 response code, which could mean that no target page is configured on the instance, the Content-Length header isn’t set, or that the application isn’t configured to receive requests from the load balancer.
  • Connection timeout – Health check requests from the load balancer to EC2 instances are timing out, potentially because the instance has too much load and is taking longer than the response timeout period to respond.
  • Public key authentication failure – A load balancer using HTTPS or SSL fails public key authentication, usually because the public key on the SSL certificate doesn’t match the load balancer’s public key.
  • Instance not receiving load balancer traffic – An instance’s security group is blocking traffic due to configurations that block traffic from the load balancer.
  • Ports on instance are not open – Health checks are blocked by a port or firewall, usually, because the specified port isn’t open and listening.

ELB Health Check Configuration Options 

You can adjust health check configurations and monitor the health state of instances through the AWS console. Health check configurations allow you to specify ports, protocols, and the ping path used to conduct health checks. Protocols supported include TCP, HTTP, HTTPS, and SSL. You can also choose any port from 1 to 65535. Other configuration options include:

Health Check Interval – Setting a health check interval determines the length of the period between pings. The health check interval is set at 30 seconds by default, but you can reduce it to five seconds or increase it up to 300 seconds.

Response Timeout – The response timeout is the amount of time an instance has to respond before it’s marked as unavailable. The response timeout is five seconds by default but can be anywhere between two and sixty seconds.

Healthy/Unhealthy threshold counts – Healthy and unhealthy threshold counts determine the number of successive health checks an instance needs to pass or fail before it’s marked as healthy or unhealthy. Threshold counts can range between two and ten health checks.

What Health Metrics Should I Monitor?

Monitoring the health of instances is important because you want to make sure that ELB can scale to meet real-time demand to deliver an exceptional end-user experience for your customers. The more instances go down, the more your application performance will be affected, which could alienate users.

Some metrics you should monitor are shown below:

  • UnHealthyHostCount – Number of unhealthy instances that are failing health checks (should be less than 20%).
  • RequestCount – Number of requests ELB received and sent to EC2 instances during a given time period. Measures the amount of traffic ELB is managing.
  • SurgeQueueLength – Number of inbound requests waiting to be accepted by the load balancer. When too many requests are queued, latency increases leading to poor user experience.
  • SpilloverCount – Number of requests rejected during a given time period after the SurgeQueueLength reaches a limit of 1,024 requests.
  • HTTPCode_ELB_4XX* – Number of 4xx client errors returned during a given time period. Shows requests that failed due to a bad gateway, unavailable service, or gateway timeout.
  • HTTPCode_ELB_5XX* – Number of 5xx server errors returned during a given time period. Provides a measure of incorrect requests.

How to Check the Health of Instances 

Amazon ELB makes it very easy to check up on the status of instances. To check the health of an instance, follow the instructions below:

  1. Open the Amazon EC2 console.
  2. Go to the navigation pane click LOAD BALANCING > Load Balancers. 
  3. Select the load balancer you want to use.
  4. Navigate to the Description tab and view Status to see how many instances are in service.
  5. Go to the Instances tab and go to the Status column to view the status of each instance.

Alternatively, you can use the AWS CLI and enter the describe-instance-health command:

aws elb describe-instance-health --load-balancer-name my-load-balancer

Monitoring Instances with CloudWatch 

Another option for monitoring ELB is to use Amazon CloudWatch. CloudWatch collects performance data from ELB that you can use to monitor the health status of EC2 instances. In CloudWatch you can configure threshold-based alarms to monitor instances and receive notifications when there is a problem.

To monitor CloudWatch metrics with the Amazon EC2 console, follow the instructions below:

  1. Open the Amazon EC2 console,
  2. Go to the navigation pane and select LOAD BALANCING > Load Balancers.
  3. Select the load balancer you want to use.
  4. Select the Monitoring tab.
  5. Select a graph for the metrics you want to monitor (we’ve listed some below).
  • HealthyHostCount (Count of healthy hosts)
  • UnHealthyHostCount (Count of unhealthy hosts)
  • Latency (Average latency)
  • RequestCount (Count of requests)
  • BackendConnectionErrors – Count of backend connection errors
  • Surge Queue Length

You can also view CloudWatch metrics through the CloudWatch console. You can do this by following the steps below:

  1. Open the CloudWatch console.
  2. Go to the navigation pane and click Metrics.
  3. Select ELB.
  4. Type the name of a metric, load balancer, or Availability Zone in the search field to return metrics on that element. For example, typing the name of a single load balancer will show metrics on that load balancer.

The Best ELB Monitoring Software 

By default, Amazon ELB sends performance metrics on your load balancer to CloudWatch, but there are plenty of other alternative platforms you can use to monitor ELB. In this section, we’re going to look at some of the top tools for monitoring AWS ELB that you can use to monitor the status of instances.

Here is a list of the top software for monitoring Amazon ELB:

  1. Datadog – Cloud monitoring software with AWS integration, custom dashboards, anomaly detection, alerts, and more.
  2. Dynatrace – Application performance monitoring software with Amazon CloudWatch monitoring, graphs, charts, custom dashboards, anomaly detection, and more.
  3. Paessler PRTG Network Monitor – Infrastructure monitoring software with an Amazon CloudWatch ELB sensor, custom alerts, reports, a mobile app, and more.

1. Datadog

Datadog screenshot

Datadog is a cloud monitoring tool you can use to monitor AWS Elastic Load Balancing. With Datadog you can use the Amazon Web Services integration to collect performance metrics from ELB and monitor everything from the health of individual hosts to workloads, and application performance through the dashboard.

The dashboard is completely customizable and includes visualizations so you can view graphs on metrics including Requests per second and Avg round-trip latency. The software comes with a mobile app so that you can monitor your environment no matter where you’re located.

Anomaly detection notifies you about unusual performance fluctuations so that you can respond. The feature is sophisticated enough to identify temporary fluctuations so that it avoids false positives. You also have the ability to configure custom alerts with thresholds, so you can set a threshold for metrics of your choice and wait to be notified via email, Slack, or PagerDuty.

Datadog is worth researching if you’re looking for a tool to measure ELB performance. The Infrastructure package starts at $15 (£11.65) per host per month. You can start the 14-day free trial.

Key Features:

  • Amazon Web Services integration
  • Custom dashboard
  • Anomaly detection
  • Alerts
  • Mobile app

2. Dynatrace

Dynatrace

Dynatrace is an application performance monitoring solution that allows you to monitor Amazon CloudWatch data, logs, and network performance in one place. With Dynatrace you can view performance metrics on AWS ELB instances including latency, requests, backend connection errors, failure rate, 4xx errors, and 5xx errors.

Visualization options like graphs and charts make it easier to keep track of performance trends. Customizable dashboards display performance metrics of your choice. Custom alerts allow you to configure metric thresholds to notify you about particular performance events.

Anomaly detection is one of the most useful features included with Dynatrace, as it can identify performance anomalies and pinpoint the root cause. Fast root cause diagnosis means less time spent troubleshooting.

Dynatrace is a great alternative for monitoring ELB that you can use to monitor CloudWatch metrics alongside the performance of other applications. The Infrastructure monitoring package starts at $21 (£16.30) per month. You can start the 15-day free trial.

Key Features:

  • Monitor AmazonCloudWatch data
  • Custom dashboard
  • Alerts
  • Graphs and charts
  • Anomaly detection

3. Paessler PRTG Network Monitor

PRTG Network Monitor

Paessler PRTG Network Monitor is an infrastructure monitoring software that can monitor Amazon ELB. The platform contains an Amazon CloudWatch ELB sensor to monitor ELB, displaying metrics on Backend Connection Errors, Unhealthy Hosts, Requests, HTTPCode Backend 2XX, HTTPCode Backend 4XX, HTTPCode ELB 5XX, and more. The sensor includes visual dials so you can make sense of metrics at a glance.

The software also has an alerts system that you can set threshold values to decide when notifications are triggered. For example, you could configure the Paessler PRTG Network Monitor to alert you if there are more than five unhealthy hosts. Notifications can be sent by email, SMS, syslog, push notifications, (via a mobile app for Android and iOS), Slack messages, and more.

With the reporting engine, you can create reports on-demand in HTML, PDF, and CSV to share with the rest of your team. You can set a schedule and the recipients the report will be sent to. You can change the content of reports based on out-of-the-box templates.

Paessler PRTG Network Monitor offers a way to combine Amazon CloudWatch metrics on ELB alongside data other network performance data. It is free for up to 100 sensors. Pricing starts at $1,750 (£1,358) for 500 sensors and one server installation. You can start the 30-day free trial.

Key Features:

  • Amazon CloudWatch ELB sensor
  • Alerts
  • Reports
  • Mobile app

Combine Health Checks and Performance Monitoring Tools 

If you’re new to ELB, learning about health checks is a great first step to getting to grips with monitoring the health of instances. Proactively monitoring the health of instances will ensure that you have the resources on hand to route application traffic efficiently and reduce undesirable latency.

From CloudWatch to Datadog, Dynatrace, and Paessler PRTG Network Monitor, you have plenty of simple and effective solutions for monitoring ELB, so you can choose the tool that’s right for your needs.

Leave a Reply