Section 4: Elastic Load Balancing and Auto Scaling Flashcards
Scaling Up (vertical scaling)
- Adding resources to the instance.
- Limitation is still have a single point of failure (SPOF).
- Can reach limit.
Example: t2.micro, 1vCPU, 1 GB RAM to c5.xlarge, 4vCPU, 8GB RAM.
Lesson 56
Scaling Out (horizontal scaling)
- Add one or more instances.
- Resiliency.
- Unlimited.
Example: add more t2.micro to existing t2.micro.
Lesson 56
Amazon EC2 Autoscaling (Dynamo and ECS also supported)
- EC2 Auto Scaling launches and terminates instances dynamically.
- Scaling is horizontal (scales out).
- Provides elasticity and scalability.
- Cannot scale across Regions.
- Responds to EC2 Status Checks and CloudWatch metrics.
- Can scale based on demand (performance) or on a schedule.
- Scaling policies define how to respond to changes in demand.
- Auto Scaling groups define collections of EC2 instances that are scaled and managed together.
Lesson 57
Configuration Steps of an Auto Scaling Group
- A Launch Template specifies the EC2 instance configuration.
1b. A Launch Configuration replaced by a Launch Template) has fewer features. - Configure purchase option - On-Demand vs Spot.
- Configure VPC and Subnets.
- Attach Load Balancer.
- Configure health checks EC2 and ELB.
- Group size and scaling policies.
Lesson 57
Launch Template information
- AMI and instance type.
- EBS volumes.
- Security Groups.
- Key Pair.
- IAM Instance profile.
- User data.
- Shutdown behavior.
- Termination protection.
- Placement Group Name.
- Capacity Reservation.
- Tenancy.
- Purchasing Option (e.g. Spot).
Lesson 57
Launch Configuration information
- AMI and instance type.
- EBS volumes.
- Security Groups.
- Key Pair.
- Purchasing Option (e.g. Spot).
- IAM instance profile.
- User data.
Lesson 57
Amazon EC2 Auto-Scaling Health Checks
EC2 = EC2 status checks.
ELB = (Recommend enabling) Uses the ELB health checks in addition to EC2 health checks.
Lesson 57
Amazon EC2 Auto Scaling Health Check Grace Period
- How long time wait before checking the health status of the instance.
- Auto Scaling does not act on health checks until grace period expires.
Lesson 57
Amazon EC2 Auto Scaling Monitoring
Group Metrics (ASG):
- Data points about the Auto Scaling Group.
- 1-minute granularity.
- No charge.
- Must be enabled.
Basic Monitoring (Instances):
- 5-minute granularity.
- No charge.
Detailed Monitoring (Instances):
- 1-minute granularity.
- Charges apply.
- Enabled by default when creating launch configurations through the CLI.
Lesson 57
Additional Scaling Settings
- Cooldowns - Used with simple scaling policy to prevent Auto Scaling from launching or terminating before the effects of previous activities are visible. Default value is 300 seconds (5 minutes).
- Termination Policy - Controls which instances to terminate first when a scale-in event occurs.
- Termination Protection - Prevents Auto Scaling from terminating protected instances.
- Standby State - Used to put an instance in the InService state into the StandBy state, update or troubleshoot the instance.
-
Lifecycle Hooks - Used to perform custom actions by pausing instances as the ASG launches or terminates them.
Use case: - Run a script to download and install software after launching.
- Pause an instance to process data before a scale-in (termination) (e.g. extract a log file).
Lifecycle diagram in PPT.
Lesson 57
Load Balancing and High Availability
- Distribute the connections to multiple instances (and can be in multiple AZs).
- If an instance fails, the load balancer will re-route the connection.
- Regularly use Auto Scaling and Load Balancing together.
Lesson 59
(ELB) Application Load Balancer (ALB) - Layer 7 (HTTP, HTTPS)
- Operates at the request level.
- Routes based on the content of the request (layer 7).
- Supports path-based (URL) routing, host-based (Domain name) routing, query string parameter-based (URL) routing, and source IP address-based routing.
- Supports instances, IP addresses, Lambda functions and containers as targets.
Load balancer protocol - HTTP, HTTPS.
Lesson 60
(ELB) Network Load Balancer (NLB) - Layer 4 (TCP, TLS, UDP, TCP_UDP)
- Operates at the connection level.
- Routes connections based on IP protocol data (layer 4).
- Offers ultra-high performance, low latency, and TLS offloading at scale.
- Can have a static IP / Elastic IP.
- Supports UDP and static IP addresses as targets.
Lesson 60
(ELB) Classic Load Balancer (CLB) (deprecated) - Layer 4 and 7
- Old generation, not recommended for new applications.
- Performs routing at Layer 4 and Layer 7.
- Use for existing applications running in EC2-Classic.
Lesson 60
(ELB) Gateway Load Balancer (GLB) - Layer 3
- Used in front of virtual appliances such as firewalls, IDS/IPS, and deep packet inspection systems.
- Operates at Layer 3 - listens for all packets on all ports.
- Forwards traffic to the Target Group (TG) specified in the listener rules.
- Exchanges traffic with appliances using the GENEVE protocol on port 6081.
Lesson 60