Auto Scaling adjusts EC2 capacity based on demand—add instances when CPU is high, remove when idle. It pairs with Elastic Load Balancing for resilient web tiers.
Components
- Launch template — AMI, instance type, security groups, user data script
- Auto Scaling group — min, max, desired capacity across AZs
- Scaling policies — target tracking on CPU, request count, or schedules
- Health checks — replace unhealthy instances automatically
Typical web pattern
Users → Application Load Balancer → Auto Scaling group (multiple EC2 in two AZs) → RDS database. Apps built with Django or Node deploy similarly behind a load balancer.
Preview CLI
aws autoscaling describe-auto-scaling-groups \
--query 'AutoScalingGroups[].{Name:AutoScalingGroupName,Desired:DesiredCapacity,Min:MinSize,Max:MaxSize}' \
--output tableLearners may have empty results until they create a group—this confirms CLI access.
Important interview questions and answers
- Q: Desired capacity?
A: Target number of instances the group maintains under normal conditions. - Q: Why scale across AZs?
A: Survive AZ failure and distribute load—ALB registers instances per AZ.
Self-check
- Name three Auto Scaling components.
- Why pair Auto Scaling with a load balancer?
Tip: Draw min/desired/max on paper before exams—interviewers love capacity vocabulary.
Interview prep
- Desired capacity?
Target instance count Auto Scaling maintains under normal load.
- With load balancer?
Distributes traffic across scaled instances across AZs.