Amazon Elastic Load Balancing (ELB) is a service that automatically distributes incoming application traffic across multiple targets, such as Amazon EC2 instances, containers, and IP addresses, to ensure your applications are fault-tolerant and scalable. It monitors the health of its registered targets, and routes traffic only to the healthy targets. Elastic Load Balancing scales your load balancer capacity automatically in response to changes in incoming traffic.
Automatic Distribution: ELB distributes incoming application traffic across multiple targets to ensure high availability.
Scalability: ELB can handle varying traffic loads in a single Availability Zone or across multiple Availability Zones.
High Availability: Ensures your applications remain accessible and fault-tolerant.
Security: Provides robust security features, including integration with AWS Shield for DDoS protection, and supports secure protocols and SSL/TLS termination.
Types of Elastic Load Balancers
Application Load Balancer (ALB)
Layer: Operates at Layer 7 (Application Layer).
Use Case: Best suited for HTTP and HTTPS traffic.
Routing: Routes traffic based on the content of the request (e.g., URL, host-based, and path-based routing).
Advanced Features: Supports WebSocket, HTTP/2, and enhanced security with SSL/TLS termination. Ideal for micro-services and container-based architectures.
Network Load Balancer (NLB)
Layer: Operates at Layer 4 (Transport Layer).
Use Case: Best suited for TCP traffic requiring extreme performance.
Performance: Capable of handling millions of requests per second with ultra-low latencies.
Traffic Handling: Optimized for sudden and volatile traffic patterns, making it ideal for latency-sensitive applications and real-time communications.
Classic Load Balancer (CLB) (Deprecated)
Layer: Supports both Layer 4 (Transport Layer) and Layer 7 (Application Layer).
Use Case: Provides basic load balancing for applications.
Note: CLB is the oldest type and is not recommended for new applications as it lacks many of the advanced features found in ALB and NLB.
Gateway Load Balancer (GLB)
Layer: Operates primarily as a Layer 3 (Network Layer) load balancer.
Use Case: Distributes traffic to virtual appliances and scales them up or down.
Advanced Features: Ideal for use cases involving third-party virtual appliances for security, network analytics, or other specialized network functions.
Comparison and Use Cases
Application Load Balancer (ALB)
Use Case: Ideal for microservices and containerized applications, requiring advanced request routing.
Features: Host-based, path-based routing, WebSocket, HTTP/2 support, and deep integration with AWS services.
Network Load Balancer (NLB)
Use Case: Suitable for applications needing high throughput and low latency, such as gaming servers or real-time communication systems. Ultra-low latency, Static IP addresses, VPC endpoint services, etc.
Features: High performance, low latency, optimized for sudden traffic spikes, and supports TCP, UDP, and TLS traffic.
Gateway Load Balancer (GLB)
Use Case:
Deploy, scale and manage 3rd party virtual network appliances.
Centralized inspection and monitoring.
Firewalls, intrusion detection and prevention systems, and deep packet inspection systems.
Features: Basic load balancing at both Layer 4 and Layer 7, lacks the advanced routing capabilities of ALB and performance optimizations of NLB.
Best Practices
High Availability: Deploy load balancers across multiple Availability Zonesto ensure fault tolerance.
Security: Use SSL/TLS for secure communication, and integrate with AWS Shield for DDoS protection.
Monitoring: Use Amazon CloudWatch to monitor load balancer performance and health checks to ensure the health of your targets.
Scaling: Configure Auto Scaling groups with your load balancers to automatically adjust capacity based on demand.
Elastic Load Balancing works with the following services to improve the availability and scalability of your applications.
Amazon EC2 — Virtual servers that run your applications in the cloud. You can configure your load balancer to route traffic to your EC2 instances. For more information, see the
Amazon EC2 Auto Scaling — Ensures that you are running your desired number of instances, even if an instance fails. Amazon EC2 Auto Scaling also enables you to automatically increase or decrease the number of instances as the demand on your instances changes. If you enable Auto Scaling with Elastic Load Balancing, instances that are launched by Auto Scaling are automatically registered with the load balancer. Likewise, instances that are terminated by Auto Scaling are automatically de-registered from the load balancer. For more information, see the
AWS Certificate Manager — When you create an HTTPS listener, you can specify certificates provided by ACM. The load balancer uses certificates to terminate connections and decrypt requests from clients.
Amazon CloudWatch — Enables you to monitor your load balancer and to take action as needed. For more information, see the
Amazon ECS — Enables you to run, stop, and manage Docker containers on a cluster of EC2 instances. You can configure your load balancer to route traffic to your containers. For more information, see the
AWS Global Accelerator — Improves the availability and performance of your application. Use an accelerator to distribute traffic across multiple load balancers in one or more AWS Regions. For more information, see the
Route 53 — Provides a reliable and cost-effective way to route visitors to websites by translating domain names into the numeric IP addresses that computers use to connect to each other. For example, it would translate www.example.com into the numeric IP address 192.0.2.1. AWS assigns URLs to your resources, such as load balancers. However, you might want a URL that is easy for users to remember. For example, you can map your domain name to a load balancer. For more information, see the
AWS WAF — You can use AWS WAF with your Application Load Balancer to allow or block requests based on the rules in a web access control list (web ACL). For more information, see the