Elastic Load Balancing automatically distributes incoming application traffic across multiple targets, such as EC2 instances, containers, and IP addresses. It can handle the varying load of your application traffic in a single AZ or across multiple AZ.
Elastic Load Balancing offers three types of load balancers that all feature the high availability, automatic scaling, and robust security necessary to make your applications fault tolerant.
Application Load Balancer
Are best suited for load balancing of HTTP and HTTPS traffic. They operate at Layer 7 and are application-aware. They are intelligent, and you can create advanced requesting routing, sending a specified request to specified servers. Supports path-based routing, and can request one or more EC2 instance or VPC container.
Network Load Balancer
Best suited for load balancing of TCP traffic where extream performance is requested. Operating at the connection level (layer 4), Network Load balancer is capable of handling millions of requests per second, while maintaining ultra-low latencies. Network Load Balancer routes traffic to targets within VPC.
Classic Load Balancer
Are the legacy ELB. You can load balance HTTP/HTTPS applications and use Layer 7-specific features, such X-Forwarded and sticky sessions. The use of strict layer 4 loads balancing for applications that rely purely on the TCP protocol. Supports both either EC2-Classic or VPC instances.
Classic load balancer Takes your request and forwards it onto the EC2. X-Forward-For header stores the public IP address and then passes the address off an EC2 instance.
- Static or elastic IP address: Use Network Load Balancer
- Need control over your SSL cipher: Use Classic Load Balancer
- Container services and/or ECS: Use Application Load Balancer or Network Load Balancer
- If you need to support SSL offloading: Use Application Load Balancer or Classic Load Balance
If your application stops responding, the ELB responds with the 504 error. 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 then scale it up or scale it out
There are 3 different types of load balancers:
- Application Load Balancer
- Network Load Balancer
- Classic Load balancers
A 504 Error means the gateway has timed out. Which means that the application not responding within that idle timeout period. To troubleshoot look at each application and identify the breakage.
If you need the IPv4 address for your end user, look at the X-Forwarded-For header within your instance. Most of the time this is not needed.