Section 8: High Availability and Scalability, ELB & ASG Flashcards
What are the two types of scalability?
Horizontal Scaling and Vertical Scaling
Define Vertical Scalability and its use cases
Vertical scaling is increasing / decreasing the instance size/power (from regular EC2 to baremetal, for example).
Use Cases: non-distributed systems, like DBs, and when you have a hardware limit for scaling
Define Horizontal Scalability and its use cases
Horizontal Scaling (elasticity) is increasing / decreasing the number of instances.
Use Cases: Distributed systems (web apps, modern apps) & ASGs / load balancers
High availability and ____ go hand in hand
Horizontal Scaling (for running instances for the same app, across multiple AZs
What is the goal of High availability?
To survive an unexpected data center loss
What is a load balancer?
Load balancers are physical / virtual servers that forward traffic to multiple servers (EC2 instances) downstream. They do not need to be internet facing.
What are some reasons to use a load balancer? 5 things.
1) Spread load across multiple downstream instances
2) Expose a signle point of access (DNS) to your application
3) Easily handle failure of downstream instances
4) Separate private and public traffic
5) regular health checks and SSL termination (HTTPS) for websites
What are the four (4) types of Elastic Load Balancers (ELBs)?
1) ALB (application load balancer)
2) Network Load Balancer (NLB)
3) Gateway Load Balancer (GLB)
4) Classic Load Balancer (CLB)
When should you use an ALB?
ALBs are best suited for load balancing of HTTP, Websocket & HTTPS traffic. They provide a static DNS name but not a static IP.
What level do ALB’s perform health checks
ALBs perform health checks at the target group level. Target groups include EC2 instances, Lambda Functions, IP addresses, and more.
What are two ALB use cases
1) Micro Services
2) Container based applications (docker, amazon ECS)
When should you use an NLB?
NLBs are suited for load balancing of TCP (transmission control protocol) traffic where extreme performance is required
What are three (3) main qualities of NLBs?
1) provides Static DNS name and Static IP
2) Can support millions of requests per second and ultra-low latencies compared to ALB
3) NLBs are meant for extreme performance, TCP and UDP traffic
When should you use a GLB?
A GLB should be used when network traffic must be inspected before sending it to an application
What are some use cases for GLB?
1) firewalls, intrusion detection, preventative systems
2) deploying, scaling and managing a fleet of 3rd party network virtual appliances
What re some use cases for CLB (Classic load balancer?)
None. CLBs are deprecated.
What are Sticky Sessions (session affinity) and what do they do?
Sticky Sessions bind a user’s session to a specific EC2 instance or target (ALB).
Sticky Sessions ensure all requests from the user will be sent to the same place to make sure the user doesn’t lose session data
What are two cons of Sticky Sessions?
1) If you aren’t getting connected to a specific EC2 instance, you might need to disable Sticky Sessions
2) Enabling stickiness can bring imbalance to the load
Stickiness is achieved by using two types of cookies. What are these cookies called?
1) Application based cookies
2) Duration based cookies
What are Application Based Cookies?
Application Based Cookies are generated by an an application or a load balancer, named specifically for each target group
What are Duration Based Cookies?
Cookie generated by a load balancer, named AWSALB for ALBs, AWSELB for CLB
What is Cross Zone Load Balancing?
When a load balancer balances a load evenly across targets in Multiple AZs
What if Cross Zone Load Balancing is not enabled?
Requests will be distributed in the instances of the load balances, but no guarantee the loads will be balanced across AZs. Cross Zone is always on for ALBs
What if Cross Zone Load Balancing is not enabled?
Requests will be distributed in the instances of the load balances, but no guarantee the loads will be balanced across AZs
What Does an SSL (Secure Socket Layer) / TSL (Transport Layer Security) certificate do?
SSL certificates allow traffic between your clients and your load balancer to be encrypted in transit (in-flight encryption)
How does SSL / LS work with load balancers?
1) User connects to load balancer via HTTPs
2) Load Balancer verifies if network is encrypted
3) Load Balancer navigates encrypted traffic to EC2 Instance
What is SNI (Server Name Indication) and what does it do?
SNI allows users to load multiple SSL certificates into one or different web servers via load balancers. Only applicable to ALB / NLB / CloudFront, and all traffic is HTTPS
What are the four (4) main goals of an ASG (Auto Scaling Group)?
1) Scale out (add EC2 instances) to match increased load
2) Scale in (remove EC2 instances) to match decreased load
3) ensure a minimum and maximum amount of machines running
4) Automatically register new instances to a load balancer
Can you assign IAM roles to an ASG?
Yes. IAM roles attached to an ASG will get assigned to the correlative EC2 instances
How much does an ASG cost?
ASG’s are free, you only pay for the underlying resources launched in the ASG
What happens if an instance in an ASG fails a health check?
the ASG will automatically create a new instance as a replacement
What are the attributes of an ASG?
1) Launch configuration (resources to be used, SGs, Storage, etc.)
2) Min / Max size, Initia; / desired capacity
3) Network, load balancer & subnet information
4) Scaling policies (what triggers a scale in or scale out)
What are the two types of Automatic Scaling policies for an ASG?
1) Dynamic scaling policies
2) Predictive scaling policies
What are the three types of Dynamic Scaling Policies for an Automatic Scaling ASG?
1) Target Tracking Scaling
2) Simple / Step Scaling
3) Schedule Actions
What is Target Tracking Scaling for an ASG?
Sets an average ASG CPU preference, and is the most simple scaling policy to set up / use
What is Simple / Step Scaling for an ASG?
Simple / Step scaling utilizes CloudWatch alarms to configure scaling steps.
For example: when a CloudWatch alarm is triggered, then a preset action is performed (like add or subtract a certain amount of EC2s)
What are Scheduled Action scaling policies for an ASG?
Scheduled Action policies are used to anticipate scaling based on known usage patterns. This proactive scaling helps to scale during desired time windows
For example: People come to your site to stream the new show every Friday at 5 pm, so you preset EC2 scaling.
What are four (4) good metrics to base your ASG scaling on?
1) CPU utilization: average CPU usage across instances
2) Request count per target: ensures number of requests per EC2 instances is stable
3) Average in / out operations: for network bound apps
4) Custom metrics pushed using CloudWatch
What is Manual Scaling for an ASG?
Manual Scaling for an ASG is when you specify maximum and minimum ASG capacity
What is an ASG Scaling Cooldown period and why is it beneficial?
An ASG scaling cooldown period is a default 300 second waiting period that prevents ASGs from launching or terminating additional instances before the effects of previous activities are visible.
What is the default ASG Termination Policy?
The default termination policy finds the AZ which has the most instances.
If there are are multiple instances in the AZ to choose from, it will delete the one with the oldest launch configuration
By default, how do ASGs manage EC2 instances in an Az?
By default, ASGs try to balance the number of instances across an AZ