Scaling Policies: Target Tracking and Step Scaling
Configure target tracking to maintain a CPU utilisation target and step scaling to react to CloudWatch alarm thresholds.
Why Scaling Policies Exist
Static desired capacity works when load is constant, but real-world traffic fluctuates. Scaling policies let an Auto Scaling Group adjust the desired capacity automatically in response to metrics. AWS offers three main dynamic policy types: Target Tracking, Step Scaling, and Simple Scaling. For the SAA-C03 exam, target tracking and step scaling are the most important to understand.
Target Tracking Scaling Explained
Target Tracking Scaling works like a thermostat: you specify a metric and a target value, and AWS automatically calculates how many instances to add or remove to keep the metric at that target. For example, if you target 50% average CPU utilisation and utilisation climbs to 80%, ASG will add enough instances to bring CPU back to 50%. AWS manages both scale-out and scale-in actions for you.
aws autoscaling put-scaling-policy \
--auto-scaling-group-name 'MyAppASG' \
--policy-name 'TargetTrackingCPU50' \
--policy-type TargetTrackingScaling \
--target-tracking-configuration '{
"PredefinedMetricSpecification": {
"PredefinedMetricType": "ASGAverageCPUUtilization"
},
"TargetValue": 50.0
}'All lessons in this course
- Launch Templates and ASG Configuration
- Scaling Policies: Target Tracking and Step Scaling
- Scheduled Scaling and Predictive Scaling
- Instance Refresh and Lifecycle Hooks