Auto Scaling Groups (ASG)
Overview

Auto Scaling Groups (ASG)

August 3, 2026
4 min read

ASG Basics

The goal: scale EC2 instances out to match load, scale in to save money, and always keep a minimum number running.

SettingMeaning
Min SizeThe ASG will never go below this number.
Max SizeThe ASG will never go above this number.
Desired CapacityHow many instances you want running right now. Changing it manually causes an immediate launch or terminate.

Launch Template vs Launch Configuration

FeatureLaunch Template (recommended)Launch Configuration (legacy)
Modifiable?Yes — versioning supportedNo — immutable, must recreate
Instance typesMixed instances (Spot + On-Demand)Single instance type only
FeaturesT2/T3 Unlimited, Dedicated HostsLimited feature set
Exam verdictAlways use thisOnly under explicit legacy constraints

Scaling Policies

The exam cares much more about which policy fits the scenario than about how to configure one.

Dynamic Scaling

Reactive scaling based on live metrics (CPU, network in/out, request count).

Target Tracking

  • Concept: “Keep the average CPU at 50%.”
  • How: You set a target value and the ASG creates the CloudWatch alarms for you. Above the target it adds instances, below it removes them.
  • Keywords: “maintain average metric”, “easiest to set up”.

Step Scaling

  • Concept: “Slightly high → add 1 instance. Very high → add 3.”
  • How: You define steps based on how badly the alarm is breached.
  • Key feature: Does not wait for the cooldown during scale out, so it reacts to spikes faster than Simple Scaling.

Simple Scaling (legacy)

  • Concept: “Alarm breached → add 1 instance.”
  • Downside: Must wait for the full cooldown period (default 300s) before scaling again. Step Scaling is preferred.

Predictive Scaling

Uses machine learning on historical data to forecast the next 48 hours and schedule scaling in advance.

Keywords: “recurring business patterns”, “scale proactively before the load hits”.

Scheduled Scaling

Scaling on a known clock — “every Friday at 5 PM traffic spikes”, “big marketing event Monday at 9 AM”.

Important ASG Mechanics

Scaling Cooldowns

A pause after a scaling activity (default 300 seconds) that lets metrics stabilize. During cooldown the ASG will not launch or terminate anything. Simple Scaling respects it; Step Scaling can override it for scale out.

If the ASG is thrashing (scaling up and down repeatedly), increase the cooldown.

Health Checks: EC2 vs ELB

CheckWhat it verifies
EC2 status checks (default)Only that the VM itself is running. Hardware failure → replace.
ELB health checks (optional)The application health, via the load balancer.
Important (Exam Tip)

The classic scenario: the instance is running (EC2 check passes) but the app is returning HTTP 500.
With ELB health checks enabled, the ASG terminates and replaces it.
With them disabled, the ASG keeps a broken app in rotation.

Termination Policy

When scaling in, the default policy picks the victim like this:

  1. Find the AZ with the most instances (keeps AZs balanced).
  2. Terminate the instance using the oldest launch template/configuration.
  3. Tie break on whichever is closest to the next billing hour.

You can enable Instance Scale-In Protection to shield specific instances — useful for long running jobs.

Advanced Features

Lifecycle Hooks

Pause an instance during creation or termination to run a custom action.

HookWhenUse Case
Pending:WaitCreated but not yet serving trafficInstall software, download large datasets
Terminating:WaitAbout to be destroyedUpload logs to S3, extract final data

Typically wired to EventBridge or SNS → Lambda.

Instance Refresh

Updates every instance in the ASG to a new launch template (new AMI, new user data) with no downtime, using a rolling batch-by-batch replacement. Checkpoints let you say “replace 20%, then wait an hour” to verify stability.

Warm Pools

  • Problem: Instances take 5+ minutes to boot and install software, making dynamic scaling too slow to matter.
  • Solution: A pool of pre-initialized instances kept in a Stopped state.
  • Benefit: Scaling out starts a stopped instance instead of building a new one — dramatically faster.

Scenario Cheat Sheet

ScenarioSolution
Traffic is unpredictable and spikyTarget Tracking on a CPU or network metric
Traffic has a known weekly patternScheduled Scaling
Need to scale before the load hits, based on historyPredictive Scaling
Prevent one specific instance from being terminatedScale-In Protection
App takes 10 minutes to install on bootWarm Pools, or bake a Golden AMI
Run a script before an instance terminatesLifecycle Hook (Terminating:Wait)
Patch the OS across all ASG instancesInstance Refresh (rolling update)
Availability Zones are unbalancedASG rebalances automatically — launches in one AZ, terminates in another