High Availability & Scalability: ELB & ASG Flashcards
An application/system can handle greater loads by adapting
Scalability
What are two types of scalability
Vertical
Horizontal (elasticity)
Vertical Scalability means..
Increasing the size of an instance
Horizontal scalability means..
Increasing the # of instances/systems for your application
Horizontal scaling implies what?
Distributed systems
What is the goal of High Availability?
To survive a data center loss
Scale up/down
Vertical Scaling
Scale in/out
Horizontal Scaling
Run instances for the same application across multi AZ
High Availability
A server that will forward traffic to multiple servers (e.g., instances) downstream
Load Balancing
Which is easier to use ELB or LB & why?
ELB because it’s managed by AWS & cost less
A way for your ELB to verify if your EC2 Instance is properly working?
Health Checks
The health check is done on a what? (2)
Port and a route
If the response is not (blank), then the instance is unhealthy
200
Health Checks are crucial for..
Load Balancers
Name the four types of Load Balancers
Classic LB
Application LB
Network LB
Gateway LB
Which Load Balancer is deprecated?
CLB
- Supports TCP (Layer 4), HTTP & HTTPS (Layer 7)
- Health checks are TCP or HTTP based
- Fixed host name XXX.región.elb.amazonaws.com
What LB type is this?
CLB
Due to AWS changes, instead of modifying the rule, you must
1) Delete existing HTTP rule
2) Create a new rule with the ‘source’ being the CLB security group
- 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 & WebSocket
- Support redirects (from HTTP to HTTPS for example)
What LB type is this?
ALB
- Great fit for micro services & container based application (ex. Docket & Amazon ECS)
- Has a port mapping feature to redirect to a dynamic port in ECS
What LB type is this?
ALB
What are NLBs used for?
Extreme Performance
TCP
UDP traffic
- Layer 4
- Forward TCP & UDP traffic to your instances
- Less latency ~ 100 ms
- Has one static IP per AZ
- Supports assigning Elastic IP (helpful for whitelisting)
What LB type is this?
NLB
What does TCP stand for?
Transmission Control Protocol
A communications standard that enables application programs and computing devices to exchange messages over a network
TCP
A communication protocol used across the Internet for especially time-sensitive transmissions such as video playback or DNS lookups.
UDP
What does UDP stand for?
User Datagram Protocol
- Deploy, scale, and manage a fleet of 3rd party network virtual appliances in AWS
- Firewalls, Intrusion Detection and Prevention Systems, Deep Packet Inspection Systems, payload manipulation
- Operates at Layer 3 (Network Layer) - IP Packets
What LB type is this?
Gateway LB
Uses the GENEVE protocol on port 6081
What LB is this?
Gateway
Single entry/exit for all traffic
Transparent Network Gateway
Stickiness works for which LBs?
ALB & CLB
What is the use case for sticky sessions?
Make sure the user doesn’t lose his session data
The same client is always redirected to the same instance behind a load balancer
What is this called?
Sticky sessions
Name the two types of cookies
Application & Duration based
The (blank) is designed to remember information about you, including a record of your website visits and activity
Cookie
Why do websites use cookies?
- To recognise your pc
- To tailor the website experience to you
- To track your activity as you navigate the website
- To analyze your use of the website
- To enhance the websites usability
What is Application-based Cookie name?
AWSALBAPP
What is Duration-based Cookie name?
AWSALB for ALB
AWSELB for CLB
Each LB instance distributes evenly across all registered instances in all AZ
Cross Zone Load Balancing
Requests are distributed in the instances of the node of the Elastic Load Balancer
Without Cross Zone Load Balancing
- CZLB always on (can’t be disabled)
- No charges for inter AZ data
Which LB is this?
ALB
- CZLB is disabled by default
- You pay charges for Inter AZ data if enabled
Which LB is this?
NLB
- CZLB is disabled by default
- No charges for inter AZ data if enabled
Which LB is this?
CLB
Allows traffic between your clients and your load balancer to be encrypted in transit (in-flight encryption)
SSL certificate
What is the newer version of SSL?
TLS (Transport Layer Security)
What does SSL stand for?
Secure Sockets Layer
What is SSL used for?
To encrypt connections
(Blank) certificates are mainly used
TLS
What solves the problem of loading multiple SSL certificates onto one web server?
SNI (Server Name Indication)
Does CLB support SNI?
No (it’s deprecated)
What does ALB & NLB support? (2)
SNI & multiple SSL certificates
Will give time to complete “in-flight requests” while the instance is de-registering or unhealthy
Connection Draining
- Scale out (add EC2 instances) to match an increased load
- Scale in (remove EC2 instances) to match decreased load
- Ensure we have a minimum and maximum # of machines running
- Automatically Register new instances to a load balancer
What is this feature called?
Auto Scaling Group (ASG)
Having instances under an ASG means that if they get terminated for whatever reason, the ASG will automatically what?
Create new ones as a replacement
Are ASG free?
Yes
IAM roles attached to an ASG will get assigned to ..
EC2 instances
ASG will try to balance the (blank) of instances across (blank) by default
Number; AZ
You have the ability to perform extra steps before the instance goes in service (Pending state)
Lifecycle Hooks
You have the ability to perform some actions before the instance is terminated (Terminating state)
Lifecycle Hooks
What does AWS recommend, Launch Configuration or Launch Template?
Launch Template
- Find the AZ which has the most # of instances
- If there are multiple instances in the AZ to choose from, delete the one w the oldest configuration
What is this process called?
ASG Default Termination Policy
- Most simple and easy to set up
- Ex: I want the average ASG CPU to stay at around 40%
Which Dynamic Scaling Policy is this?
Target Tracking Scaling
- When a CloudWatch alarm is triggered, then add 2 units
- When a CloudWatch alarm is triggered, then remove 1
Which Dynamic Scaling Policy is this?
Simple/Step Scaling
- Anticipate a scaling based on known usage patterns
- Ex: increase the min capacity to 10 at 1700 on Friday’s
Which Dynamic Scaling Policy is this?
Scheduled Actions
Continuously forecast load and schedule scaling ahead
Which ASG type is this?
Predictive Scaling
think this the future because it is machine learning powered & it’s a hands off approach to scaling your ASG
What are good metrics to scale on?
CPUUtilization
RequestCountPerTarget
Average Network In/Out (if application is network bound)
Any custom metric
Cool down period by default is how long?
300 seconds (5 min)
During the cool down period what happens?
The ASG will not launch or terminate additional instances
Scaling an EC2 instance from r4.large to r4.4xlarge is called what?
Vertical Scalability
Elastic Load Balancers provide a static what?
DNS name
To get the client’s IP address, ALB adds an additional header called what?
X-Forwarded-For
What feature won’t send traffic to unhealthy (crashed) EC2 instances?
Health checks
Which LB provides the highest performance and lowest latency?
Network Load Balancer
Application Load Balancers supports which protocols?
HTTP
HTTPS
WebSocket
ALBs can route traffic to different Target Groups based on what?
URL Path
Hostname
HTTP Headers
Query Strings
Which type of Elastic Load Balancer has one static IP address per AZ?
Network Load Balancer
Which cookie names are reserved by the ELB?
AWSALB
AWSALBAPP
AWSALBTG
Which feature in both ALB & NLB allows you to load multiple SSL certificates on one listener?
Server Name Indication (SNI)
What allows you to expose multiple HTTPS applications each with its own SSL certificate on the same listener
Server Name Indication (SNI)
Can the ASG go over the maximum capacity (you configured) during scale-out events?
No
When an EC2 instance fails the ALB Health Checks what happens?
The ASG will terminate the EC2 instance
What does 0.0.0.0/0 mean?
All possible IP addresses
Referencing by (blank) in rules is an extremely powerful rule.
Security Groups
The Default Termination Policy for ASG is what?
- Find the AZ which has the MOST instances
2. Terminate based on OLDEST Launch Template
Which LBs have a static DNS name?
ALB & CLB