Skip to content
Elastic Load Balancer
Elastic Load Balancer
- Helps balance load across multiple different servers.
- Equally balance load between servers
Types of Load Balancers
- Application
- Operates at OSI Layer 7
- Make very clever decisions, all the way down to the application layer
- Can see that packets are destined for a certain server
- Wheather or not someone is making a purchase
- Network
- Layer 4
- Super fast performance/speed
- Most expensive load balancer
- Use this in production
- If latency is an issue
- Classic load balancer
- Not recommended to use
- Legacy purposes
- Dev Associate exam has mostly classic load balancer
Application load balancers
- Best suited for load balancing of HTTP and HTTPs traffic
- Operate at layer 7
- Application aware
- Intelligent, and can create advanced request routing, sending specified requests to specific web servers
- Tesla Model X
- Send all the car's traffic to servers designed for only Model X
- Model S cars traffic is sent to a different server
Network Load Balancer
- Best suited for balancing TCP traffic
- Extreme performance is required
- Operating at the connection level (layer 4)
- Capable of handling millions of requests per second
- Maintaining ultra-low latencies
- EXTREME performance and most costly
Classic Load Balancer
- Legacy ELB
- Load balance HTTP/HTTPS apps and use Layer 7 specific features
- X-Forwarded and sticky sessions
- Use strict layer 4 load balancing for apps that rely purely on the TCP protocol
Load Balancer Errors
- Classic
- Responds with 504 if application stops responding
- Application is having issues
- Could be at the Web server Layer or Database Layer
- Identify where the application is failing and scale it up or out where possible
User |
ELB |
EC2 |
123.12.3.231 |
10.0.0.23 |
10.0.0.23 |
- EC2 will only see the private ip (10.0.0.23)
- Look for the IPv4 public ip in the x-forwarded for header
Exam Tips
- 3 types of load balancers
- Application
- Network
- Classic
- 504 Error means the gateway has timed out
- Application is not responding within the idle timeout period
- Troubleshoot the application
- Is it web server or database server?
- If you need the IPv4 address of your end user (classic load balancer), look for the X-Forwarded-For Header
- Sticky Sessions (Session Affinity)
- Enables the load balancer to bind a user's session to a specific instance
- This ensures that all requests from the user during the session are sent to the same instance
- Keeps the user from having to re-authenticate when switching pages
- Classic load balancer supports IPv6 as well as IPv4
- as well as dualstack (both IPv4 and IPv6)
- VPC does not support IPv6
- When your load balancer is created, it receives a public DNS name that clients can use to send requests.
- The DNS servers resolve the DNS name of your load balancer to the public IP addresses of the load balancer nodes for your load balancer
- Never resolve the IP of load balancer, always use the DNS name.
- If you need to expose HTTP and HTTPS:
- Open port 80 (HTTP)
- Open port 443 (HTTPS)
- Assign an SSL certificate to the load balancer
- this ensures our load balancer can expose an HTTPS endpoint