High Availability and Scalability: ELB & ASG Flashcards
What are the 4 goals of an Auto Scaling Group?
- Add EC2 instances to match an increased load
- Remove EC2 instances to match a decreased load
- Ensure we have min and max number of machines running
- Automatically register new instances to a load balancer
True or False
It is possible to scale an ASG based on CloudWatch alarms
True
ASG scaling policies are based on what?
Any metric you want. It can be CPU, Network, or even more custom metrics or based on a schedule (if you know your visitors’ patterns)
What is the pricing for ASG?
ASG are free. You pay for underlying resources being launched.
When will ASG terminate instances?
ASG will terminate instances marked as unhealthy by a load balancer and replace them with a new instance
Name the 4 ASG Scaling Policies
Target Tracking Scaling
eg. I want average CPU to stay around 40%
Simple / Step Scaling
eg. When alarm triggered, add 2 units
Scheduled Actions
eg. increased min capacity to 10 on Fridays
Predictive Scaling
continuously forecast load and schedule scaling ahead
Good metrics to scale ASG on?
- CPU Utilization
- request counts per target
- average network in / network out
- any custom metric in CloudWatch
What is an ASG scaling cooldown?
After scaling activity happens, there is a cooldown period where ASG will not launch or terminate instances.
This time is to allow metrics to stabilize.
How does ASG default termination policy work?
- Find AZ with most number of instances
- If multiple instances in AZ to choose from, delete the one with the oldest launch configuration
- ASG tries to balance number of instances across AZ
When can you add lifecycle hooks into ASG?
- between pending and in service
2. between terminating and terminated
Pros/Cons of Launch Template vs Launch Configuration in ASG
With Launch Templates (newer) you can:
- have multiple versions
- create parameter subsets
- provision using on-demand or spot instances (or mix)
- can utilize T2 unlimited burst feature
- must only be created once
You scale an EC2 instance from r4.large to r4.4xlarge.
Is this vertical or horizontal scalability?
Vertical Scalability
You run an application on an Auto Scaling Group that scales the number of EC2 instances.
Is this vertical or horizontal scalability?
Horizontal Scalability
True or False
Elastic Load Balancers provide a static DNS name we can use in our application.
True.
Only Network Load Balancer provides both static DNS name and static IP. While, Application Load Balancer provides a static DNS name but it does NOT provide a static IP. The reason being that AWS wants your Elastic Load Balancer to be accessible using a static endpoint, even if the underlying infrastructure that AWS manages changes.
You are running a website on 10 EC2 instances fronted by an Elastic Load Balancer. Your users are complaining about the fact that the website always asks them to re-authenticate when they are moving between website pages. You are puzzled because it’s working just fine on your machine and in the Dev environment with 1 EC2 instance. What could be the reason?
The ELB does not have Stick Sessions enabled.
ELB Sticky Session feature ensures traffic for the same client is always redirected to the same target (e.g., EC2 instance). This helps that the client does not lose his session data.