Introduction to Load Balancing on AWS
What is Load Balancing?
Load balancing is the process of distributing incoming network traffic across multiple backend EC2 instances or servers. This helps ensure no single instance is overwhelmed, improving performance and availability.
How Load Balancing Works
- An Elastic Load Balancer (ELB) is placed in front of multiple EC2 instances.
- When users connect to the load balancer, their requests are evenly distributed among backend instances.
- Users do not directly interact with individual EC2 instances but instead connect to a single endpoint provided by the load balancer.
- If an instance fails, the load balancer detects it via health checks and stops sending traffic to it.
Why Use a Load Balancer?
- Single Point of Access – Users only need to connect to the load balancer, simplifying access to applications.
- High Availability & Fault Tolerance – Automatically reroutes traffic if an instance becomes unhealthy.
- SSL Termination – Handles HTTPS encryption and decryption.
- Sticky Sessions – Can enforce session stickiness using cookies.
- Public vs. Private Traffic Separation – Can differentiate between internal and external traffic.
- AWS Managed Service – AWS handles maintenance, scaling, and availability of the ELB.
Types of AWS Load Balancers
AWS offers four types of managed load balancers:
1. Classic Load Balancer (CLB)
- Introduced in 2009 (V1).
- Supports HTTP, HTTPS, TCP, SSL.