AWS Certified Solutions Architect – Associate
EC2 Auto Scaling policies: target tracking, step, predictive
Target tracking keeps a metric near a target value and is what AWS recommends first. Step scaling adds or removes capacity in steps sized by how far an alarm is breached. Scheduled scaling changes capacity at set times, and predictive scaling forecasts daily and weekly patterns to launch capacity before the load arrives.
Dynamic policies
Target tracking works like a thermostat: you pick a metric, such as ASGAverageCPUUtilization or ALBRequestCountPerTarget, and a target, and Auto Scaling manages the CloudWatch alarms. Choose a metric that falls as capacity grows.
With several target tracking policies, the group scales out if any policy wants to, and scales in only if all policies with scale-in enabled agree. You can disable the scale-in part of a policy. If policies conflict, Auto Scaling picks the one that gives the largest capacity.
Step scaling uses step adjustments that vary with the size of the alarm breach. Simple scaling makes one adjustment and then waits for a cooldown.
Scheduled and predictive
A scheduled action sets desired, minimum or maximum capacity at a time, once or on a cron schedule in a time zone you choose (UTC by default). A group can have up to 125 scheduled actions.
Predictive scaling analyzes history to find daily or weekly patterns and adds capacity ahead of the forecast. AWS suggests it for cyclical traffic, recurring batch patterns and applications that take a long time to initialize. It can be combined with dynamic scaling.
Health checks and warm pools
EC2 status checks are the default health check. Elastic Load Balancing health checks are ignored until you turn them on for the group. A custom health check can mark an instance unhealthy with SetInstanceHealth, and Auto Scaling replaces it.
The health check grace period delays health checks on new instances. It defaults to 300 seconds in the console and 0 with the CLI or SDK.
A warm pool holds pre-initialized instances for applications with long boot times. Instances can wait Stopped, Hibernated or Running. Stopped is cheapest; Hibernated keeps RAM contents on the EBS root volume; Running is discouraged because you pay for the instances. By default the pool size is maximum capacity minus desired capacity.
Where the exam catches people
- Believing one target tracking policy can block scale-out: any policy can scale out, but scale-in needs every policy with scale-in enabled to agree.
- Believing ELB health checks replace instances by default: Auto Scaling ignores them until you turn them on for the group.
- Believing a Stopped warm pool keeps loaded data in memory: only the Hibernated state saves RAM to the EBS root volume.
- Believing a warm pool fills itself whatever the group size: by default its size is maximum minus desired capacity, so equal values give an empty pool.
- Believing target tracking works on raw queue depth: AWS lists
ApproximateNumberOfMessagesVisibleas a metric that doesn't work; use messages per instance.
Written from Amazon Web Services's documentation
- Dynamic scaling for Amazon EC2 Auto Scaling
- Target tracking scaling policies for Amazon EC2 Auto Scaling
- Scheduled scaling for Amazon EC2 Auto Scaling
- Predictive scaling for Amazon EC2 Auto Scaling
- About the health checks for your Auto Scaling group
- Set the health check grace period for an Auto Scaling group
- Decrease latency for applications with long boot times using warm pools