Lesson 2 of 5 Amazon EC2 Auto Scaling

Choosing Auto Scaling Policies and Metrics

This lesson explains how scaling policies decide when Auto Scaling changes desired capacity, and how to choose the right type of policy and metric.

Learning outcomes

After completing this lesson, you will be able to:

  • Configure target tracking and step scaling.
  • Use scheduled and predictive scaling.
  • Set instance warmup and cooldowns.
  • Choose a metric that reflects load.

Dynamic scaling

Target tracking scaling keeps a metric at a target value, like a thermostat. Predefined metrics are average CPU utilisation, average network in or out, and ALBRequestCountPerTarget; custom metrics and metric math are also supported. Auto Scaling creates and manages the CloudWatch alarms, scales out quickly and scales in gradually. It is the recommended default. Step scaling uses alarms you create and adds or removes different amounts depending on how far the metric breaches the threshold, for example +2 instances at 70% CPU and +5 at 90%. Simple scaling makes one adjustment per alarm and then waits for a cooldown before responding again; it is legacy.

The following diagram shows the target tracking loop.

Target tracking as a thermostat. The policy keeps a metric such as average CPU or ALBRequestCountPerTarget near the target value. Auto Scaling creates and manages the CloudWatch alarms, scales out quickly when the metric is above target and scales in gradually when it is below.
The values are illustrative.
Sort into groups

Which scaling policy?

Exam skills 2.1.1

Choose the scaling policy for each requirement.

Log in to try this activity Interactive activities are free with an account.

Scheduled and predictive scaling

Scheduled scaling sets minimum, maximum or desired capacity at specific times with cron expressions and a time zone, for example raising the minimum to 10 at 08:30 on weekdays. Predictive scaling uses machine learning on at least 24 hours (ideally 14 days) of history to forecast load and launches capacity ahead of daily and weekly patterns; it can run in forecast only mode for evaluation first and is usually combined with target tracking for unexpected changes. When several policies apply at once, Auto Scaling chooses the one that gives the largest capacity.

PolicyUse whenNotes
Target trackingKeep a metric at a valueRecommended default; manages alarms
Step scalingDifferent responses to different breach sizesYou manage alarms
Simple scalingLegacyWaits for cooldown between actions
Scheduled scalingKnown times, such as business hoursCron with time zone
Predictive scalingRecurring daily or weekly patternsLaunches capacity ahead of demand

Warmup and cooldown

New instances need time to boot and warm caches before their metrics are representative. The default instance warmup tells Auto Scaling how long to wait before counting a new instance's metrics, preventing it from scaling out further because new instances temporarily raise or lower averages. Set it to the time the application takes to become ready. Cooldowns apply only to simple scaling. If instances take too long to become ready, scaling lags demand, which warm pools (next topic) address.

Scenario questions

Warmup and cooldown

Exam skills 2.1.1

Tune how quickly a group reacts after it scales.

Log in to try this activity Interactive activities are free with an account.
Worked example

Choosing a metric

A web tier scales on average CPU at 50%, but at peak, latency rises while CPU stays at 40% because each request waits on a downstream API. CPU does not reflect load for this application. The team switches the target tracking policy to ALBRequestCountPerTarget with a target of 800 requests per target per minute, measured in a load test as the point where latency starts to degrade. They add predictive scaling because the traffic has a clear daily pattern, so capacity is already in place at 08:00 when users arrive.

Check yourself

Which policy suits load that rises at a known time every weekday?

Show answer

Scheduled scaling, or predictive scaling for recurring patterns.

Exam Tips

Remember for the exam

  • Target tracking is the default choice; it creates its own alarms.
  • Step scaling responds proportionally to the size of the breach.
  • Scheduled scaling for known times; predictive scaling for recurring patterns.
  • ALBRequestCountPerTarget suits web tiers whose CPU does not reflect load.
  • Default instance warmup stops new instances distorting metrics.