DEV Community

Le Huy Ho
Le Huy Ho

Posted on

Learning AWS - DVA - Day 5: ELB (Elastic Load Balancer)

What is load balancing?

Load Balancers are servers that forward traffic to multiple backend or downstream EC2 instances or servers.


Why use a load balancer?

  • Spread load across multiple downstream instances

  • Expose a single point of access (DNS) to your application

  • Seamlessly handle failures of downstream instances because the load balancer will have some health check mechanisms.

  • Provide SSL termination (HTTPS) for your websites

  • Enforce stickiness with cookies

  • High availability across zones

  • Separate public traffic from private traffic


Why use an AWS Elastic Load Balancer?

  • An Elastic Load Balancer is a managed load balancer (AWS will be managing it - AWS takes care of upgrades, maintenance, HA - AWS guarantees that it will be working,...)

  • It cost less to setup your own load balancer but it will be a lot more effort on your end.

  • It is integrated with many AWS offering / services:

    • EC2, EC2 Auto Scaling Groups, Amazon ECS
    • AWS Certificate Manager (ACM), CloudWatch
    • Route 53, AWS WAF, AWS Global Accelerator ## Health Checks
  • Health Checks are crucial for Load Balancers

  • They enable the load balancer to know if instances it forwards traffic to are available to reply to request.

  • The health check is done on a port and a route (/health is common)

  • If the response is not 200 OK, then the instance is unhealthy


Types of Load Balancer on AWS

AWS has 4 kinds of managed Load Balancers:

  • Classic Load Balancer - CLB (v1 - old generation): HTTP, HTTPS, TCP, SSL (Secure TCP) (deprecated at AWS and will soon not be available in the AWS console)

  • Application Load Balancer - ALB (v2 - new generation): HTTP, HTTPS, Websocket

  • Network Load Balancer - NLB (v2 - new generation): TPC, TLS (Secure TCP), UDP

  • Gateway Load Balancer - GWLB: Operates at layer 3 (Network layer) - IP protocol

Some load balancers can be setup as internal (private) or external (public) ELBs

Top comments (0)