High Availability and Scalability: ELB & ASG Flashcards

1
Q

What is scalability?

A

Means your application can adapt to accommodate for greater loads

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

What are the 2 kinds of scalability

A

Vertical
Horizontal (elasticity)

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

Vertical Scalability

A

Increasing the Size of the instance

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

Common use case of Vertical scalability?

A

Non distributed systems such as database

RDS, Elasticache

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

What is the limit of Vertical Scalability?

A

Hardware limit

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

Horizontal Scalability

A

Increase the number of instances/systems for your app

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

What does horizontal scaling implies?

A

That you have distributed systems

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

What is horizontal scalability most common for?

A

Web apps / modern apps

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

What is High Availability?

A

Means running your app / system in at leas 2 data centres (AZ)

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

Goal of HA?

A

Survive a data centre loss

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

HA can be passive and also active. Give 2 examples

A

Passive - RDS Multi AZ
Active - Horizontal Scaling

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

What type of scalability is Auto Scaling Group & Load balancer part of?

A

Horizontal Scaling

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

What is Auto Scaling Group multi AZ & Load Balancer multi AZ part of?

A

High Availability

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

What is a Load Balancer (ELB)

A

servers forward traffic to multiple servers (EC2 instances) down stream

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

What can provide Spreading of load across multiple downstream instances?

A

ELB

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

What can expose single point of access (DNS) to your app?

A

ELB

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

What can seamlessly handle failures of downstream instances?

A

ELB

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

What can do regular health checks to your instances?

A

ELB

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

What can provide SSL termination (HTTPS) for your websites?

A

ELB

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

What can enforce stickiness with cookies?

A

ELB

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

What can provide HA across zones?

A

ELB

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

What can separate public traffic from private traffic?

A

ELB

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

ELB is integrated with

A

EC2, EC2 Auto Scaling Groups, Amazon ECS

AWS Certificate Manager (ACM), CloudWatch

Route 53, AWS WAF, AWS Global Accelerator

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

How do ELB do health checks of EC2 instances?

A

Have a dedicated port and a route. Its important to know when to not send traffic to an instance if its down

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

What does the instance response need to be to be healthy?

A

200 OK

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

How many types of ELB are there on AWS?

A

4

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

What are the types of ELB?

A
  1. Classic Load Balancer (HTTP, HTTPS, TCP, SSL (Secure TCP)
  2. Application Load Balancer (HTTP, HTTPS, WebSocket)
  3. Network Load Balancer (TCP, TLS (secure TCP), UDP)
  4. Gateway Load Balancer (layer 3 (Network Layer)) - IP protocol
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

Load Balancer Security Groups Architecture

A

Users use HTTPS/HTTP From anywhere to connect to Load Balancer. The SG on LB allows 80 (HTTP) and 443 (HTTPS).

The SG of the EC2 instance ONLY allows the SG from the LB to connect via HTTP (80). So the source will not be an IP, but the SG name. And allow traffic only.

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

Which OSI Layer is Application LB?

A

7 - ONLY HTTP

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

What does Application LB have support for?

A

HTTP/2 & WebSocket

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

Does Application LB support redirects?

A

Yes from HTTP to HTTPS

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

What are ALB great for?

A

Micro services & container-based applications

(Docker & Amazon ECS)

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

ALB can route, to different target groups. Give an ex.

A

example.com/users & example.com/posts

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

Benefit of ALB

A

You can have just 1 for multiple applications

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

ALB Architecture example

A

1 App Load Balancer routing www.example.com/user to HTTP target group for Users (2 EC2) and also routing example.com/search to another target group for Search applications that have 2 different EC2 instancesd

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

What are Target Groups?

A

Can be
1. EC2 instances (managed by ASG) HTTP
2. ECS tasks (ECS managed) HTTP
3. Lambda Functions - HTTP req is translated into a JSON event
4. IP Addr - must be private IP

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

Can ALB route to multiple target groups?

A

Yes

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

Where are the health checks done with an ALB?

A

Target Group Level

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

What can you do with an ALB to redirect 2 different types of traffic to 2different target groups?

A

Write Query Strings/Parameters

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

How does the Client IP talk to EC2 instance with an ALB in the middle?

A

ALB uses Connection Termination which takes the client public IP and then uses the Load Balancers Private IP to talk to the EC2 instance

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

What layer is Network Load Balancer in?

A

Layer 4 - Transport Layer

42
Q

What does Network Load Balancer allow?

A

Forward TCP & UDP traffic to instances

43
Q

Benefit of having NLB vs ALB?

A

Less latency ~100 ms

44
Q

How many static IP does NLB have per AZ?

A

Only 1

45
Q

Does support Elastic IP?

A

Yes

46
Q

What can you connect with an NLB?

A

Target Groups with:
1. EC2 instances
2. IP of EC2 instances/servers
3. Target Group that has an ALB inside

47
Q

Can you put an NLB in front of an ALB?

A

Yes

48
Q

What health checks does NLB support?

A

TCP
HTTP
HTTPS protocols

49
Q

When would you use a Gateway Load Balancer for?

A

Firewalls, IDS/IPS, Deep Packet Inspection Systems, Payload manipulation..

Basically you can redirect all traffic into one of the above using the GLB

50
Q

Gateway Load Balancer Architecture Scenario

A

User traffic goes to routing table, which goes to GLB, then GLB distributes traffic to Target groups (firewall EC2, IDS, etc) then they get checked, go back to the GLB, then get sent to the application

51
Q

Which OSI layer does Gateway Load Balancer operate at?

A

Layer 3 - Network layer (IP packets)

52
Q

What are the two functions of a Gateway Load Balancer?

A
  1. Transparent Network Gateway
  2. Load Balancer
53
Q

What does a Transparent Network Gateway function of a Gateway Load Balancer do?

A

Single entry/exit for all traffic

54
Q

What does Load Balancing of GLB does?

A

Distributes traffic to your virtual appliances

55
Q

Which Load Balancer uses GENEVE protocol on port 6081?

A

Gateway Load Balancer

56
Q

What are GLB Target Groups?

A

EC2 Instances & IP Addresses (private)

57
Q

What are Sticky Sessions (Session Affinity)

A

When you have 3 clients, 1 Load Balancer, and 2 EC2 instances and you redirect client 1 ALWAYS to the same EC2 instance. You can do the same with the other 2 clients for example.

58
Q

Which Load Balancers can have Sticky Sessions?

A

Network / App load balancers

59
Q

How does a sticky session work? (technical)

A

Cookie is used and has an expiration date you control

60
Q

Why would you use a sticky session?

A

For the user so they do not lose their session data

61
Q

What are the 2 session cookies you can have for Sticky Sessions?

A

Application (custom & application) & duration

62
Q

Who creates the Duration cookie?

A

The load balancer

63
Q

Who creates the custom cookie in App base cookies?

A

The target

64
Q

Who creates the application cookie in app based cookies?

A

Load balancer

65
Q

Cross Zone Load Balancing

A

2 AZ and 2 LB. 1 AZ has 2 instances, the other has 8. Regardless of which LB the traffic goes to, it will be distributed 50/50 on each AZ. This means that all 10 EC2 get 10% traffic, so it is even

66
Q

Which LB is Cross Load Balancing enabled by default?

A

Application Load Balancer

67
Q

Which LB is Cross Load Balancing disabled by default?

A

Network & Gateway

68
Q

What is an SSL certificate?

A

Allows traffic between clients & load balancer to be encrypted in transit

69
Q

SSL meaning

A

Secure Sockets Layer

70
Q

TLS meaning

A

Transport Layer Security (newer version of SSL)

71
Q

Who issues public SSL certificates?

A

Certificate Authorities (CA)

72
Q

How doe SSL Certs work?

A

Users contact Load balancer using HTTPS over public internet, then ssl termination happens inside load balancer, and then HTTP is used over VPC to reach EC2 instance

73
Q

What is an X.509 certificate?

A

SSL/TLS Server cert

74
Q

What is an HTTPS listener?

A

It is a socket that is established between server and client. This is how you connect

75
Q

What is SNI?

A

Server Name Indication

76
Q

What does SNI solve?

A

How to load multiple SSL certs onto one web server (for multiple websites)

77
Q

What does SNI require the client to indicate?

A

Host name of the target server in the initial SSL handshake. Then the server knows which certificate to use

78
Q

SNI only works for which LB?

A

App & Network & CloudFront

79
Q

What is Connection Draining? (Deregistration Delay)

A

Sets the time to complete the “in-flight requests” while the instance is de-registering or unhealthy

80
Q

What happens when you de-register an EC2 instance?

A

Load Balancer stops sending new requests to that “unhealthy” instance

81
Q

What does an Auto Scaling Group (ASG) do when load increases/decreases

A

Allows to scale in/out to match load

82
Q

What can you ensure with an ASG?

A

That you have minimum / maximum number of EC2 instances running

83
Q

What can an ASG do automatically?

A

Register new instances to a Load Balancer

84
Q

What happens if an EC2 instance is terminated (unhealthy) and is in an ASG?

A

It automatically creates a new one in its place

85
Q

What do you set in an ASG?

A

Minimum
Desired
Maximum capacity

86
Q

What is an ASG Launch Template?

A

It contains information on how to launch EC2 instances within your ASG - contains all the info you need (parameters)

87
Q

ASG can be triggered by which AWS service?

A

CloudWatch Alarm

88
Q

What can trigger a CloudWatch Alarm?

A

Metrics such as Average CPU usage etc

89
Q

What are the 2 kinds of Auto Scaling Policies?

A

Dynamic & Predictive

90
Q

How does Target Tracking Scaling Work (dynamic)

A

E.g. I want ASG CPU usage to stay at around 40%

91
Q

How does the Simple / Step Scaling work (dynamic)

A

Cloud watch alarm, when CPU goes over 70% add 2 units.

When CPU goes under 30% remove one unit

92
Q

How do Scheduled Actions work in ASG (dynamic)

A

Based on known usage patterns

e.g. Increase min capacity to 10 at 5pm on Fridays

93
Q

How does Predictive Scaling work?

A

Continuously forecast load and schedule scaling ahead

  1. Analyse historical load
  2. Generate forecast
  3. Schedule scaling actions
94
Q

What are some good metrics to scale on?

A
  1. CPU Utilisation
  2. Request Count Per Target
  3. Average Network In/Out
  4. Any custom metric (cloud watch)
95
Q

What are Scaling Cooldowns?

A

After scaling activity you are in a cool down period (300 sec)

96
Q

What is an ASG not allowed to do during a cooldown period?

A

Terminate, or launch instances

97
Q

How can you reduce cooldown period of ASG?

A

Use ready-to-use AMI

98
Q

An Elastic Load Balancer provides

A

Stati DNS name

99
Q

What do you do if your website only sees your Load Balancers private address instead of your users?

A

Modify websites back end to get the client IP address from the X-Forwarded-For header

100
Q

What protocols do ALBs support?

A

HTTP/HTTPS/WebSocket