AWS offers four primary types of load balancers: Application Load Balancer, Network Load Balancer, Gateway Load Balancer, and the older Classic Load Balancer. These are all part of the Elastic Load Balancing service, which is designed to automatically distribute incoming application traffic across multiple targets.
Elastic Load Balancing responds not only to varying traffic volumes but also reroutes traffic based on health check results and user-defined rules. Among its key features is integration with Auto Scaling, allowing the number of Amazon EC2 instances to adjust in response to traffic fluctuations, ensuring that the load balancing environment can dynamically scale with changing demand.
Health checks play a crucial role in determining the health status of the targets, and advanced routing options are available, particularly with Application Load Balancers, for routing requests based on their content.
Additionally, AWS load balancers are deeply integrated within the AWS ecosystem, offering advanced features like security enhancements through AWS WAF and AWS Shield, and operational monitoring using Amazon CloudWatch, further enhancing their functionality and effectiveness in the AWS cloud environment.
What are key features of ELB in AWS
Elastic Load Balancing (ELB) in AWS provides a comprehensive set of features designed to enhance the performance and availability of applications:
Efficient Load Distribution
Distributes incoming traffic across multiple backends, like EC2 instances in one or many Availabilit Zones, boosting scalability and availability.
High Performance and Fault Tolerance
Manages thousands of requests per second with minimal latency, maintaining consistent performance, especially during peak traffic periods.
Health Check Mechanism
Performs regular health assessments on backend instances, routing traffic only to operational ones to uphold high availability.
Integrates with autoscaling to modify EC2 instance numbers in response to traffic fluctuations, ensuring efficient resource use.
Versatile Load Balancing Options
Accommodates both internet-facing load balancers for external traffic and internal load balancers for traffic within Virtual Private Clouds (VPCs).
Supports Application Load Balancers (ALB) for HTTP/HTTPS traffic (layer 7) and Network Load Balancers (NLB) for TCP/UDP traffic (layer 4).
Evenly distributes traffic across multiple Availability Zones, enhancing fault tolerance and load management.
Handles SSL/TLS decryption, reducing the encryption burden on backend instances so you don't need to use Let's encryrpt or buy SSL certificates.
Session Affinity (Sticky Sessions)
Maintains user session continuity by binding sessions to specific instances.
AWS Service Integration
Seamlessly operates with AWS Auto Scaling, CloudWatch, and AWS Certificate Manager.
Robust Security Features
Integrates with AWS WAF and AWS Shield, offering advanced protection against web threats and DDoS attacks.
Advanced ALB Routing
Includes path-based and host-based routing, allowing for precise traffic direction.
Port-Based NLB Routing
Enables multiple applications to run on a single EC2 instance, with each application using a distinct port.
Operational Monitoring and Logging
Provides real-time traffic insights via access logs and CloudWatch metrics.
Prevents interruption of in-progress requests during instance scaling or maintenance.
How does ELB work in AWS?
Each of the four types of Elastic Load Balancers (ELBs) in AWS, namely Application Load Balancer (ALB), Network Load Balancer (NLB), Classic Load Balancer (CLB), and Gateway Load Balancer (GLB), operates with distinct mechanisms and components suited to their specific use cases.
While ALB and NLB primarily use listeners, target groups, and targets for managing and routing traffic, CLB and GLB have different configurations. CLB, being older, has a simpler setup focusing on EC2 instances as targets and does not use target groups. GLB is unique as it operates at the network layer (Layer 3) and is designed for forwarding traffic to appliances like firewalls and intrusion detection systems
Here's how these components work together:
Listeners wait for incoming traffic on the ELB. They are configured with a protocol and a port for connections (for example, HTTP on port 80, or HTTPS on port 443).
When a request is received, the listener checks its rules to determine how to route the request. These rules are based on the URL path, hostname, HTTP headers, and other factors for Application Load Balancers (ALBs).
A target group is used to route requests to one or more registered targets, such as EC2 instances, IP addresses, or Lambda functions.
In the case of ALBs and Network Load Balancers (NLBs), each listener rule specifies a target group to which traffic should be forwarded.
Target groups also define health check settings. Health checks are used to determine the health status of each target.
Targets within a target group can be EC2 instances, IP addresses, or Lambda functions that process the requests.
The ELB continually checks the health of each target using the configured health checks. If a target is deemed unhealthy, ELB stops sending traffic to it until it becomes healthy again.
Load Balancer Types
Depending on the type of load balancer (ALB, NLB, or Classic Load Balancer), the behavior of listeners and target groups can vary. For instance, ALBs are application-aware and can make advanced routing decisions, while NLBs work at the transport layer and are optimized for high performance and low latency.
Routing and Load Balancing Algorithm
The ELB routes incoming traffic to targets based on the configured rules in the listeners.
It uses load balancing algorithms (like round-robin or least outstanding requests) to efficiently distribute traffic among the targets in a target group.
Scalability and Availability
ELB can automatically adjust and scale according to the incoming traffic.
It also ensures high availability by distributing traffic across multiple targets in different Availability Zones.
Comparison of AWS Elastic Load Balancers: ALB, NLB, CLB, and GLB
|Application Load Balancer (ALB)
|Network Load Balancer (NLB)
|Classic Load Balancer (CLB)
|Gateway Load Balancer (GLB)
|Layer 7 (Application layer)
|Layer 4 (Transport layer)
|Layer 4 & 7
|Layer 3 (Network layer)
|TCP/UDP & HTTP/HTTPS
|Advanced request routing for web applications, microservices, containers
|Handling volatile, high-volume traffic, real-time applications
|Simple load balancing for applications built within EC2-Classic network
|ransparent network gateway for third-party virtual appliances
|Content-based (path, hostname, headers)
|IP, TCP, UDP
|Limited, based on protocol or path
|High throughput, moderate latency
|Very high throughput, low latency
|Designed for third-party virtual appliance throughput
|IP Address Preservation
|No (uses X-Forwarded-For header)
|No (uses X-Forwarded-For header)
|EC2 instances, containers, IP addresses, Lambda functions
|EC2 instances, containers, IP addresses
|EC2 instances, IP addresses