Elastic load balancer

Icon

ELB Icon

  • Elastic load balancer is a managed service which can spread load across multiple services.

  • It is a regional service, making them highly available.

  • Exposes a single point of access for DNS to your application.

  • AWS takes care of the infra and upgrades of load balancers.

  • Provides SSL termination for your websites.

  • Offers health checks (health endpoints), to make sure the requests are forwarded only to health instances.

  • Can be setup as public or private load balancer depending on the scheme.

  • Provides high availability across zones.

  • Can enforce stickiness with cookies.

Target groups

  • In general, group of AWS resources which would receive traffic from load balancer.

  • Allows grouping of

    • EC2 instances

    • ECS tasks

    • IP addresses (must be private)

    • Lambda function

    • Application load balancer

  • Read more about it here.

Listener

  • A listener is a process that checks for connection requests, using the protocol and port that you configure.

  • The rules that you define for a listener determine how the load balancer routes requests to its registered targets.

  • Read more about it here.

Health Checks

  • To enable load balancer to know if the instance is healthy and can forward traffic to it, health checks play crucial role.

  • Health check is done using /health endpoint (typically) running on port 4567 using http protocol.

  • They are done at target group level.

  • Health checks need to be configured when creating a target group before registering targets in to the target group.

Types of Load Balancer

Classic Load Balancer (CLB)

  • Deprecated and retired, old generation (v1).

  • Supports HTTP, HTTPS, TCP, SSL.

  • Only supported one SSL certificate for HTTPS based listeners.

Application Load Balancer (ALB)

  • Newer generation, 2016.

  • Works on layer 7 of OSI model, supports HTTP/1.x, HTTP/2 HTTPS, WebSocket, gRPC.

  • Supports redirect from HTTP to HTTPS.

  • Great fit for microservices and container-based application.

  • Supports routing to different target groups based on,

    • Path in URL

    • Hostname in URL

    • Query strings and headers

  • Port mapping feature allow to redirect to a dynamic port in ECS.

  • The IP address of the client is available in the header X-Forwarded-For, the port of the client in header X-Forwarded-Port, the protocol in header X-Forwarded-Proto.

  • Target groups can be EC2 instances, ECS Task, Lambda functions (requests are translated to JSON event), Private IP Address.

  • Health checks are done at target group level.

  • ALB as has a fixed hostname of the form xxx.region.elb.amazonaws.com.

Network Load Balancer (NLB)

  • Newer generation, 2017.

  • Not available in free-tier option.

  • Target groups can be EC2 instances, Private IP Addresses, ALB.

  • Layer 4 load balancer, supports TCP, TLS, UDP.

  • High performance, with ultra-lower latency.

  • Has one static IP per AZ, with ability to assign elastic IP to each AZ.

  • Health check supports TCP, HTTP and HTTPS.

Gateway Load Balancer (GWLB)

  • Newer generation, introduced in 2020.

  • Operates at network layer 3.

  • Target groups can be EC2 instances, Private IP Addresses.

  • Can be used to deploy, manage and scale a fleet of 3rd party virtual appliances which includes Firewalls, IDPS, Deep packet inspection etc.

  • Uses GENEVE protocol at port 6081.

References

Last updated