ELB + ASG Fundamentals Flashcards

1
Q

What is load balancing?

A

Load Balances are servers that forward traffic to multiple servers (e.g., EC2 instances) downstream.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Why use a load balancer?

A
  • 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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is Elastic Load Balancer?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are Health Checks?

A

They enable the load balancer to know if instances it forwards traffic to are available to reply to requests.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

When can we say the insance is unhealty?

A

If the health check response is not OK (200).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the 3 (4) types of ELBs?

A
  • 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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a Load Balancer Security Group?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How to redirect LB to instances?

A

Create Target groups.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How to disable request directly to App Server, but enable the LB?

A

In the App server Security Group, remove the incoming request, add a new one with the LB Security Group only.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is ALB?

A

Application Load Balancer is a Layer 7 (HTTP) load balancer.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are the features of ALB?

A
  • 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)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What kind of routing is supported for ALB?

A

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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is ALB good for?

A
  • 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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What can be part of a Target Group?

A
  • 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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Is health check per instances?

A

No, healt check is for target group level.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Can we see the IP of the client if we use ALB?

A

Yes, in the X-Forwarded-For header.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What layer is used by the Network Load Balancer?

A

The layer 4, TCP & UDP traffic. 100ms latency. Million requests / seconds.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

How many IP can be assigned to NLB?

A

One NLB has 1 static IP per AZ, supports Elasctic IP.

19
Q

Why is NLB used?

A

For extreme performance, TCP and UDP traffic.

20
Q

What can be in an NLB Target Group?

A
  • EC2 instances
  • Private IP addresses
  • ALBs
21
Q

What are the Health Check supports in NLB target groups?

A

They support TCP, HTTP os HTTPS.

22
Q

What is the usage of Gateway Load Balancer?

A
  • Deploy, scale, and manage a fleet of 3rd party network virtual appliances in AWS.
  • Example: Firewalls, Intrusion Detection and Prevention Systems, Deep Packet Inspection Systems, payload manipulation
23
Q

What layer does GLB operate?

A

It operates on the layer 3, IP packets

24
Q

What functions are combined in GLB?

A
  • Transparent Network Gateway: single entry/exit for all traffic
  • Load Balancer: distributes traffic to your virtual appliances
25
What protocol does GLB use?
Uses the GENEVE protocol on 6081
26
What are the target groups for GLB?
* EC2 instances * Private IP addresses
27
What is ELB Sticky Sessions / Session Affinity?
It is possible to implement stickiness so that the same client is always redirected to the same instance behind a load balancer.
28
What ELBs supports Sticky Sessions?
ALB, NLB
29
Whats the typical Sticky Sessions use case?
Its used to make sure users doesn't load session data (e.g. login credentials)
30
What are the prohibited cookie names if ALB is configured?
AWSALB, AWSALBAPP, or AWSALBTG
31
What is ELB Cross-Zone Load Balancing?
If configured, the load balancer will distribute the load EVENLY across all AZ.
32
Can you use Cross-Zone Load Balancing in all types of ELB?
yes, but * Application Load Balancer * Enabled by default (can be disabled at the Target Group level) * No charges for inter AZ data * Network Load Balancer & Gateway Load Balancer * Disabled by default * You pay charges ($) for inter AZ data if enabled
33
How SSL Certificates used in ELB?
The LB uses the certificate to use HTTPS. * Manage certificates in ACM * For each HTTPS listener (TG): * Must specify a default cert * Use SNI to spec. the hostname they reach
34
What is SSL Server Name Indication (SNI)?
* SNI solves the problem of loading multiple SSL certificates onto one web server (to serve multiple websites) * It’s a “newer” protocol, and requires the client to indicate the hostname of the target server in the initial SSL handshake * The server will then find the correct certificate, or return the default one
35
What is Deregistration Delay / Connection Draining?
* Time to complete “in-flight requests” while the instance is de-registering or unhealthy * Stops sending new requests to the EC2 instance which is de-registering * Between 1 to 3600 seconds (default: 300 seconds) * Can be disabled (set value to 0) * Set to a low value if your requests are short
36
What are the Auto Scaling Groups(ASG)?
* The goal of an Auto Scaling Group (ASG) is to: * Scale out (add EC2 instances) to match an increased load * Scale in (remove EC2 instances) to match a decreased load * Ensure we have a minimum and a maximum number of EC2 instances running * Automatically register new instances to a load balancer * Re-create an EC2 instance in case a previous one is terminated (ex: if unhealthy) * ASG are free (you only pay for the underlying EC2 instances)
37
What are the ASG Attributes?
* A Launch Template * Min Size / Max Size / Initial Capacity * Scaling Policies
38
What are ASG Launch Tempaltes?
* AMI + Instance Type * EC2 User Data * EBS Volumes * Security Groups * SSH Key Pair * IAM Roles for your EC2 Instances * Network + Subnets Information * Load Balancer Information
39
How to AutoScaling with CloudWatch?
It is possible to scale an ASG based on CloudWatch alarms * An alarm monitors a metric (such as Average CPU, or a custom metric) * Metrics such as Average CPU are computed for the overall ASG instances
40
What are ASG Dynamic Scaling Policies?
* Target Tracking Scaling => Target resource usage (CPU > 50%) * Simple / Step Scaling => CW alarm triggered, then add 2 unit * Scheduled Actions => At a time increase min units
41
What is ASG Predictive Scaling?
Machine Learning driven scaling. It will forecast the load and scale the LB.
42
What are the good ASG metrics?
* CPUUtilization: Average CPU utilization across your instances * RequestCountPerTarget: to make sure the number of requests per EC2 instances is stable * Average Network In / Out (if you’re application is network bound) * Any custom metric (that you push using CloudWatch)
43
What is ASG Scaling Cooldown
* After a scaling activity happens, you are in the cooldown period (default 300 seconds) * During the cooldown period, the ASG will not launch or terminate additional instances (to allow for metrics to stabilize)
44
What is ASG Instance Refresh?
Goal: update launch template and then re-creating all EC2 instances * For this we can use the native feature of Instance Refresh * Setting of minimum healthy percentage * Specify warm-up time (how long until the instance is ready to use)