AWS Fundamentals – Part II Flashcards
What is Scalability?
- Scalability means that an application / system can handle greater loads by adapting.
- There are two kinds of scalability:
• Vertical Scalability
• Horizontal Scalability (= elasticity) - Scalability is linked but different to High Availability
What is Vertical Scalability?
- Increasing the size of the instance
- Vertical scalability is very common for non distributed systems, such as a database.
- RDS, ElastiCache are services that can scale vertically.
- There’s usually a limit to how much you can vertically scale (hardware limit)
What is Horizontal Scalability?
- Horizontal Scalability means increasing the number of instances / systems for your application
- Horizontal scaling implies distributed systems.
- This is very common for web applications modern applications
- It’s easy to horizontally scale thanks the cloud offerings such as Amazon EC2
What is High Availability?
- High Availability usually goes hand in hand with horizontal scaling
- High availability means running your application / system in at least 2 data centers (AZ)
- The goal of high availability is to survive a data center loss
- The high availability can be passive (for RDS Multi AZ for example)
- The high availability can be active (for horizontal scaling)
Vertical Scaling for EC2 instance
Vertical Scaling: Increase instance size (= scale up / down)
• From: t2.nano - 0.5G of RAM, 1 vCPU
• To: u-12tb1.metal – 12.3 TB of RAM, 448 vCPUs
Horizontal Scaling for EC2 instance
Horizontal Scaling: Increase number of instances (= scale out / in)
• Auto Scaling Group
• Load Balancer
High Availability for EC2 instance:
High Availability: Run instances for the same application across multi AZ
• Auto Scaling Group multi AZ
• Load Balancer multi AZ
What is Load balancer?
Load Balances are servers that forward traffic to multiple servers (e.g., EC2 instances) downstream
Why use a load balancer?
- 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 traffic: publicf rom private
What is ELB and why yo use it?
- 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 costs less to setup your own load balancer but it will be a lot more effort on your end
- It is integrated with many AWS offerings / services
• EC2, EC2 Auto Scaling Groups, Amazon ECS
• AWS Certificate Manager (ACM), CloudWatch
• Route 53, AWS WAF, AWS Global Accelerator
What are Health Checks?
- Health Checks are crucial for Load Balancers
- They enable the load balancer to know if instances: forwards traffic to. Are available to reply to requests
- The health check is done on a port and a route (/health is common)
- If the response is not 200 (OK), then the instance is unhealthy
4 types of load balancer on AWS:
-
Classic Load Balancer (v1 - old generation) – 2009 – CLB
• 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
What is CLB?
- Supports TCP (Layer 4), HTTP & HTTPS (Layer 7)
- Health checks are TCP or HTTP based
- Fixed hostname XXX.region.elb.amazonaws.com
What is ALB?
- Application load balancers is Layer 7 (HTTP)
- 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)
- Routing tables to different target groups
- 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
What are the ALB target groups?
- 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
- ALB can route to multiple target groups
- Health checks are at the target group level
What is NLB? What it allow?
Network load balancers (Layer 4) allow to:
• Forward TCP & UDP traffic to your instances
• Handle millions of request per seconds
• Less latency ~100 ms (vs 400 ms for ALB)
How many static IP’s does the NLB has?
NLB has one static IP per AZ, and supports assigning Elastic IP
When we will use NLB?
NLB are used for extreme performance, TCP or UDP traffic
Is the NLB free?
Not included in the AWS free tier
What is GWLB?
Gateway Load Balancer
- 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, …
GWLB
- Operates at Layer 3 (Network Layer) – IP Packets
- Combines the following functions:
• Transparent Network Gateway – single entry/exit for all traffic
• Load Balancer – distributes traffic to your virtual appliances - Uses the GENEVE protocol on port 6081
What to remember about IP in GWLB – Target Groups
What is Sticky Sessions (Session Affinity)?
Its mean that the that the same client is always redirected to the same instance behind a load balancer
What is the use case for sticky sessions?
Use case: make sure the user doesn’t lose his session data