Skip to main content

MODULE 9 - Auto Scaling

Overview​

This module delves into AWS Auto Scaling, the service that automatically adjusts the number of instances based on the load. You will learn how to configure effective scaling policies.

Learning Objectives​

  • Understand Auto Scaling Groups (ASG)
  • Configure different scaling policies
  • Choose the right metrics and thresholds
  • Properly size an application
  • Avoid common mistakes

Weekly Content​

1. Auto Scaling Group (ASG)​

┌─────────────────────────────────────────────────────────────┐
│ AUTO SCALING GROUP │
├─────────────────────────────────────────────────────────────┤
│ │
│ Basic parameters: │
│ • Minimum: 2 instances (always) │
│ • Desired: 2 instances (normal) │
│ • Maximum: 10 instances (peak) │
│ │
│ Normal load High load │
│ │
│ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ │
│ │ 1 │ │ 2 │ ────► │ 1 │ │ 2 │ │ 3 │ │ 4 │ │
│ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ │
│ Desired: 2 Desired: 4 │
│ │
│ Scale Out (add) │
│ ◄──────────────── │
│ Scale In (remove) │
│ │
└─────────────────────────────────────────────────────────────┘

2. Scaling Policies​

TypeDescriptionUse Case
Target TrackingMaintains a target metricCPU at 70%, simplest
Step ScalingStep actionsGradual response
Simple ScalingOne action at a timeBasic cases
ScheduledScheduled timesPredictable patterns
PredictivePredictive MLPredictable loads
┌─────────────────────────────────────────────────────────────┐
│ TARGET TRACKING │
├─────────────────────────────────────────────────────────────┤
│ │
│ "Keep average CPU at 70%" │
│ │
│ CPU% │
│ 100│ │
│ │ ┌────┐ │
│ 90│ │ │ Scale Out │
│ │ │ ▼ │
│ 70│──────┴────────────────── Target: 70% │
│ │ ┌────┐ │
│ 50│ │ │ Scale In │
│ │ │ ▼ │
│ 30│ └───────────── │
│ └────────────────────────────► Time │
│ │
│ AWS automatically adjusts the number of instances │
│ to maintain the target. │
│ │
└─────────────────────────────────────────────────────────────┘

4. Common Metrics​

MetricTypical ThresholdNotes
CPUUtilization70%Most used
RequestCountPerTargetVariableFor ALB
MemoryUtilization80%Requires CloudWatch agent
CustomVariableApplication metrics

5. Common Mistakes​

❌ MISTAKES TO AVOID

1. Cooldown too short
→ Oscillations (repeated scale up/down)
→ Solution: Cooldown 300+ seconds

2. Thresholds too close
→ Immediate scale-in after scale-out
→ Solution: Min 20% gap between thresholds

3. Min = Max = Desired
→ No scaling at all!
→ Solution: Min < Desired < Max

4. No health check
→ Unhealthy instances kept
→ Solution: Configure ASG health checks

5. Instance too slow to start
→ Lost requests during scale-out
→ Solution: Optimized AMI, warmup period

Exercise: ASG Configuration​

Scenario​

E-commerce application with:

  • Normal traffic: 100 req/s
  • Sales peak: 1000 req/s
  • t3.medium instance handles 200 req/s

Questions​

  1. How many minimum instances?
  2. How many maximum instances?
  3. What scaling policy?
  4. What thresholds do you configure?

Deliverable​

Scaling Analysis:

  • Proposed ASG configuration
  • Justification of thresholds
  • Load increase simulation
  • Cost calculation
  1. Auto Scaling Concepts
  2. Scaling Policies
  3. Validation Quiz - 30 questions to validate your knowledge
  4. Lab: Auto Scaling

Next week: MODULE 10 - DNS and Route 53