AWS offers Elastic Load Balancing (ELB) service to help you distribute the incoming traffic to multiple targets across multiple availability zones, regions and even on-premise.
Benefits of Elastic Load Balancer
Load balancers distribute the incoming traffic to multiple targets. This gives you flexibility to scale horizontally by adding or removing targets based on request load and accommodate surge in demand.
Elastic Load Balancer regularly communicates with the targets to detect their health and stop sending traffic to the unhealthy targets. This makes your service highly available, as unhealthy targets could be fixed/replaced while the traffic is served from the remaining healthy targets.
ELB gives you an additional benefit of offloading TLS/SSL to the load balancer, thus reducing the compute cycles to encrypt/decrypt packets on target. ELB is integrated with AWS Certificate Manager to help manage the certificate renewals automatically.
Traditionally, the capacity of the server was decided based on peak demand. With ELB, you can provision a small server to serve traffic in non-peak hours and scale up as demand increases. This dramatically reduces the overall cost.
Targets from multiple regions inside AWS as well as from on-premise can be added to the load balancer, providing business continuity to your services even if one region is unavailable.
Types of AWS Load Balancer
Application Load Balancer
ALB can listen to the incoming traffic at the request level (layer 7) and supports HTTP and HTTPS protocols. It can route to targets like EC2 instances, Containers, Lambda functions and even static IP addresses provisioned on AWS or on-premises. A single ALB allows you to define different targets based on the source IP, request path, query string etc, making it an ideal choice for microservices.
Network Load Balancer
NLB listens to the incoming traffic at the connection level (layer 4) and supports TCP, UDP, and TLS protocols. It can route to targets like EC2 instances, containers, and also static IP addresses provisioned on AWS or on-premises.
Classic Load Balancer
CLB was offered by AWS before the launch of ALB and NLB. It can handle the incoming traffic at connection level (layer 4) as well as request level (layer 7), and can be routed to EC2 instances. CLB supports TCP, SSL/TLS, HTTP, HTTPS protocols. AWS strongly recommends using ALB to handle traffic at request level and NLB to handle requests at connection level.
Gateway Load Balancer
GLB operates at layer 3 as a gateway and listens to all packets and ports of incoming traffic. It then performs Load Balancing at layer 4 to route the traffic to third-party virtual appliances like firewalls, IDS/IPS, WAF, DDoS etc hosted on EC2 instances. GLB Endpoint helps configure the routing table to send the traffic to the GLB in your subnet.
AWS Elastic Load Balancing provides scalability, high availability, and security. ELB is a must-have component in your AWS infrastructure.
Application load balancers are the best choice for microservices and application based workloads. To distribute traffic over TCP/UDP you should use Network Load Balancer. Use Gateway Load Balancer to bring benefits of ELB to your third-party virtual appliances.
- Application Load Balancer | Elastic Load Balancing | Amazon Web Services. (n.d.). Amazon Web Services, Inc. https://aws.amazon.com/elasticloadbalancing/application-load-balancer/
- Network Load Balancer | Elastic Load Balancing | Amazon Web Services. (n.d.). Amazon Web Services, Inc. https://aws.amazon.com/elasticloadbalancing/network-load-balancer/
- Classic Load Balancer | Elastic Load Balancing | Amazon Web Services. (n.d.). Amazon Web Services, Inc. https://aws.amazon.com/elasticloadbalancing/classic-load-balancer/
- AWS re:Invent 2020: Introducing Gateway Load Balancer for deploying & running virtual appliances. (n.d.). Amazon Web Services, Inc. https://aws.amazon.com/elasticloadbalancing/gateway-load-balancer/