ELB + ASG Fundamentals Flashcards
What is load balancing?
Load Balances are servers that forward traffic to multiple servers (e.g., EC2 instances) downstream.
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
- Do regular health checks to your instances
- Provide SSL termination (HTTPS) for your websites
- Enforce stickiness with cookies
- High availability across zones
- Separate public traffic from private traffic
What is Elastic Load Balancer?
Elastic Load Balancer is a managed load balancer
* AWS guarantees that it will be working
* AWS takes care of upgrades, maintenance, high availability
* AWS provides only a few configuration knobs
* It is integrated with many AWS offerings / services
What are Health Checks?
They enable the load balancer to know if instances it forwards traffic to are available to reply to requests.
When can we say the insance is unhealty?
If the health check response is not OK (200).
What are the 3 (4) types of ELBs?
- Classic Load Balancer (v1 - old generation) – 2009 – CLB (DEPRECATED)
- HTTP, HTTPS, TCP, SSL (secure TCP)
- Application Load Balancer (v2 - new generation) – 2016 – ALB
- HTTP, HTTPS, WebSocket
- Network Load Balancer (v2 - new generation) – 2017 – NLB
- TCP, TLS (secure TCP), UDP
- Gateway Load Balancer – 2020 – GWLB
- Operates at layer 3 (Network layer) – IP Protocol
What is a Load Balancer Security Group?
It accepts the HTTP/HTTPS request from users and forwards the HTTP call to the downstream. The application only accept traffic from the LB.
How to redirect LB to instances?
Create Target groups.
How to disable request directly to App Server, but enable the LB?
In the App server Security Group, remove the incoming request, add a new one with the LB Security Group only.
What is ALB?
Application Load Balancer is a Layer 7 (HTTP) load balancer.
What are the features of ALB?
- Load balancing to multiple HTTP applications across machines (target groups)
- Load balancing to multiple applications on the same machine (ex: containers)
- Support for HTTP/2 and WebSocket
- Support redirects (from HTTP to HTTPS for example)
What kind of routing is supported for ALB?
Routing tables to different target groups:
* Routing based on path in URL (example.com/users & example.com/posts)
* Routing based on hostname in URL (one.example.com & other.example.com)
* Routing based on Query String, Headers (example.com/users?id=123&order=false)
What is ALB good for?
- ALB are a great fit for micro services & container-based application (example: Docker & Amazon ECS)
- Has a port mapping feature to redirect to a dynamic port in ECS
- In comparison, we’d need multiple Classic Load Balancer per application
What can be part of a Target Group?
- EC2 instances (can be managed by an Auto Scaling Group) – HTTP
- ECS tasks (managed by ECS itself) – HTTP
- Lambda functions – HTTP request is translated into a JSON event
- IP Addresses – must be private IPs
Is health check per instances?
No, healt check is for target group level.
Can we see the IP of the client if we use ALB?
Yes, in the X-Forwarded-For header.
What layer is used by the Network Load Balancer?
The layer 4, TCP & UDP traffic. 100ms latency. Million requests / seconds.