Skip to content

Elastic Load Balancers

ELB Introduction

An Elastic Load Balancer automatically distributes incoming application traffic across multiple targets, such as Amazon EC2 instances, containers, and IP addresses.

Types of ELBs

Application Load Balancer

Application Load Balancers are best suited for load balancing of HTTP and HTTPS traffic. They operate at OSI Layer 7 and are application-aware. They are intelligent and you can create advanced request routing, sending specific requests to specific web servers.

Network Load Balancer

Network Load Balancers are ebst suited for load balancing of TCP traffic where extreme performance is required. Operating at the connection level (OSI Layer 4), Network Load Balancers are capable of handling millions of requests per second, while maintaining ultra-low latencies.

Use for extreme performance! Think of a Tesla Roadster.

Classic Load Balancer

Classic Load Balancers are the legacy Elastic Load Balancers. You can load balance HTTP/HTTPS applications and use Layer 7-specific features, such as X-Forwarded and sticky sessions. You can also use Layer 4 load balancing for applications that rely purely on TCP.

Load Balancer Errors

With Classic Load Balancers, if your application stops responding, the ELB responds with a 504 error (Gateway Timeout). This means that the application is having issues. This could be either at the Web Server layer or at the Database Layer. Identify where the application is failing and scale it up or down where possible.

X-Forwarded-For Header

When a user hits the load balancer (with let's say 124.12.3.231 as their IP address), the load balancer forwards their request to the EC2 instance with a private IP address instead (e.g. 10.0.0.23). The EC2 instance will see the private IP address. To get the original user's IPv4 address, you look in the X-Forwarded-For Header.