AWS Monitoring helps you gain observability into your AWS environment
Amazon Web Services Elastic Load Balancer (ELB) is a scalable and highly available load balancing solution with high throughput. It operates across OSI layers 3, 4, and 7 with its three variations: Application Load Balancer (ALB), Network Load Balancer (NLB), and Gateway Load Balancer (GWLB).
This article will take a detailed look at how the three variations operate, their configurations, and the key metrics you should monitor when using them.
Let’s first review the different types of Elastic Load Balancer.
ALB operates at the 7th OSI layer, the application layer. It's by far the most popular ELB use case and commonly implemented to distribute HTTP traffic across multiple servers. Its predecessor is now known as Classic Load Balancer and may be used by legacy applications.
NLB operates at OSI layer 4, the transport layer. NLB distributes TCP, UDP, and TLS traffic across servers.
GWLB operates at level 3, the IP layer. It is primarily used with virtual appliances using the GENEVE protocol.
All three variations of ELB function in a similar manner and have three major components: listeners, target group(s), and the load balancer. We will discuss these further below.Fig. 1: Components of ELB (Source: AWS documentation)
The first configuration you need to specify is the listener. For ALB, the protocols supported are HTTP and HTTPS with ports in the range 1 - 65535. NLB supports the TCP, UDP, TLS, and TPC_UDP protocols. The TCP_UDP protocol is for accepting both TCP and UDP traffic on the same port. You should note that for HTTPS and TLS, you need to set up an SSL certificate on the load balancer to facilitate SSL termination at the load balancer level. GWLB listens to all IP traffic on all ports; it does not permit any selective port configuration.
Once the listener protocol and port have been configured, you must configure the listener rule(s). These allow you to specify where and how to route incoming requests. Requests are usually forwarded to one or more target groups.
ALB supports a rich set of rule actions and conditions besides the default forwarding; these include fixed HTTP responses and even authentication via OIDC providers or Amazon Cognito.
Target groups allow you to combine one or more targets together. Targets will be an IP address, an EC2 instance, or when working with ALB, a Lambda function. For NLB and GWLB, you can have an EC2 instance, an IP address, or ALB as the target type.
An important component of configuring a target is setting up the health check, which is how the load balancer periodically checks a target's state of health. Some important settings when configuring health checks are:
Along with the listener and target group configuration, you must configure a load balancer with subnets and security groups.
A minimum of two subnets in different availability zones is recommended and at least eight free IP addresses to allow the load balancer to scale and achieve high availability. The security groups ensure that only the intended traffic is permitted to pass through the load balancer.
AWS provides the following ways to monitor and troubleshoot your load balancer and registered targets:
In this post, we'll focus on key CloudWatch and access log metrics. A comprehensive list of metrics is available in the official documentation.
Using the AWS CloudWatch service, you can monitor your load balancer in real time. AWS ELB frequently pushes statistics to CloudWatch that are recorded as time-series data. These data points are referred to as metrics and can be aggregated and viewed via a dashboard. CloudWatch additionally allows you to configure alarms, which send notifications when a metric level has been breached.
Web servers like Apache or Nginx maintain an access log for every request that reaches the server. AWS ELB also provides an access log, but it is turned off by default. Once it's enabled, requests are recorded to the log and stored in AWS S3. It's worth knowing that storing these access logs is an additional expense billed per the S3 service pricing. These access logs record useful metrics, which can be used to monitor and troubleshoot your load balancer.
Now, let’s look at the key metrics in these two categories. Although there are common metrics across load balancer variations, ALB in particular has a specific set of metrics one should look out for.
Listed below are some of the metrics to look out for when working with Application Load Balancer or ALB.
Listed below are some of the metrics to look out for while working with NLB.
Listed below are some of the metrics to look out for while working with Gateway Load Balancer or GLB.
To summarize, we looked at the various load balancing options provided by AWS, i.e., ALB, NLB, and GWLB. Listener rules specify which port and protocol to listen on for incoming requests and the destination target group(s) to subsequently forward the requests. Target groups are configured with the destination of a request and health checks, which determine unhealthy target group instances that need to be replaced.
Using the key metrics discussed above, you will be able to monitor the health of your load balancer and attached targets, pinpoint issues that may arise, and keep an eye on operating costs.
What are the key Amazon EBS metrics to monitor? Learn more about Amazon EBS monitoring and the key EBS metrics to track for better insights.➤
AWS lambda monitoring run applications without the added complexity of managing servers. Learn more about the key metrics to monitor for AWS lambda➤
Write for Site24x7 is a special writing program that supports writers who create content for Site24x7 “Learn” portal. Get paid for your writing.Apply Now