Learning center

EC2 Auto Scaling instance refresh failed, cancelled or rolled back

An instance refresh's Status and StatusReason, read with its preferences and the scaling activities in its window, say which gate stopped it. Launch failures, replacements that never become healthy within the hour, a CloudWatch alarm, instances in standby or protected from scale in, and a person cancelling or rolling back each leave a different combination. The gate decides the next read, and the final status decides which configuration your fleet is running now.

What the final status records#

describe-instance-refreshes returns every refresh the group ran in the last six weeks, newest first. The Status values come from a fixed set. InstanceRefresh · DescribeInstanceRefreshes

StatusWhat AWS defines it asFleet afterwards
FailedThe refresh failed to complete; troubleshoot with the status reason and scaling activitiesInstances already replaced keep the new configuration
CancelledA cancel request stopped itInstances already replaced keep the new configuration
RollbackSuccessfulA rollback, manual or automatic, completedReplaced instances were replaced again with the group's last saved configuration
RollbackFailedThe rollback failed to completeMixed, and the group may be unable to launch
BakingWaiting out the bake time after updating instancesNot finished yet

The group's own settings move to the desired configuration only after a refresh succeeds. After Failed or Cancelled, a later scale-out launches from the group's previous settings while some running instances already carry the new ones. AWS says canceling or failing before the last checkpoint does not roll back replaced instances. Instance refresh concepts · Checkpoints

Read the refresh and its preferences#

Use a read-only profile and replace the uppercase placeholders. describe-instance-refreshes

aws autoscaling describe-instance-refreshes \
  --profile PROFILE --region REGION --auto-scaling-group-name GROUP \
  --query 'InstanceRefreshes[:3].{id:InstanceRefreshId,status:Status,reason:StatusReason,start:StartTime,end:EndTime,complete:PercentageComplete,remaining:InstancesToUpdate,target:DesiredConfiguration,minHealthy:Preferences.MinHealthyPercentage,maxHealthy:Preferences.MaxHealthyPercentage,warmup:Preferences.InstanceWarmup,checkpoints:Preferences.CheckpointPercentages,checkpointDelay:Preferences.CheckpointDelay,autoRollback:Preferences.AutoRollback,alarms:Preferences.AlarmSpecification.Alarms,standby:Preferences.StandbyInstances,protected:Preferences.ScaleInProtectedInstances,rollback:RollbackDetails}' \
  --output json --no-cli-pager

target is the refresh's desired configuration: a LaunchTemplate, or a MixedInstancesPolicy whose LaunchTemplate.LaunchTemplateSpecification and Overrides name the template and types the replacements launch from. It is empty when the refresh only replaces instances with the group's current configuration.

StatusReason is free text and AWS's example for a running refresh says it is waiting for instances to warm up. Treat it as a pointer and confirm the gate from structured fields. RollbackDetails.RollbackReason says whether a rollback was manual or automatic, and PercentageCompleteOnRollback records how far the refresh had got. RollbackDetails · Check instance refresh status

Find the gate that stopped it#

A refresh replaces instances in sets. It continues only while the share of desired capacity that is in service and healthy stays at or above MinHealthyPercentage, and it waits for each replacement to pass health checks and finish warming up. When it cannot continue because replacements fail their health checks, or because it is waiting on instances in standby or protected from scale in, it keeps retrying for an hour and then fails. Instance refresh concepts · RefreshPreferences

GatePreference involvedEvidence that points to it
Launches failNoneFailed launch activities in the refresh window
Replacements never become healthyMinHealthyPercentageLaunches succeed, then termination activities with a health check cause, repeating for about an hour
Standby or protected instancesStandbyInstances, ScaleInProtectedInstances set to WaitInstances in Standby or with ProtectedFromScaleIn, and roughly an hour between start and end
CloudWatch alarmAlarmSpecificationAn alarm in the list entered ALARM before the end time; with AutoRollback the refresh rolls back, without it the refresh fails
A person or toolNoneA CancelInstanceRefresh or RollbackInstanceRefresh call near the end time

Wait is the default for standby and protected instances when you start a refresh from the CLI or an SDK; the console defaults to Ignore. A checkpoint is not a failure: the refresh stays InProgress and pauses for CheckpointDelay, one hour if you set checkpoints without a delay, and PercentageComplete lags until the latest replacements finish warming up. Default values · Checkpoints

Read the scaling activities from the refresh's start time. Launch failures carry the EC2 message in StatusMessage; health replacements carry the check in Cause. describe-scaling-activities

aws autoscaling describe-scaling-activities \
  --profile PROFILE --region REGION --auto-scaling-group-name GROUP \
  --filters Name=StartTimeLowerBound,Values=REFRESH_START_TIME \
  --query 'Activities[].{start:StartTime,status:StatusCode,description:Description,message:StatusMessage,cause:Cause}' \
  --output json --no-cli-pager

aws autoscaling describe-auto-scaling-groups \
  --profile PROFILE --region REGION --auto-scaling-group-names GROUP \
  --query 'AutoScalingGroups[0].Instances[].{id:InstanceId,state:LifecycleState,health:HealthStatus,protected:ProtectedFromScaleIn,type:InstanceType,template:LaunchTemplate.LaunchTemplateId,version:LaunchTemplate.Version}' \
  --output json --no-cli-pager

For an alarm, read its state changes in the refresh window. For a cancel or rollback, look for the API call; CloudTrail records Auto Scaling API calls with the identity that made them. describe-alarm-history · Auto Scaling in CloudTrail · lookup-events

aws cloudwatch describe-alarm-history \
  --profile PROFILE --region REGION --alarm-name ALARM_NAME \
  --history-item-type StateUpdate --start-date REFRESH_START_TIME --end-date REFRESH_END_TIME \
  --query 'AlarmHistoryItems[].{time:Timestamp,summary:HistorySummary}' \
  --output json --no-cli-pager

aws cloudtrail lookup-events \
  --profile PROFILE --region REGION \
  --lookup-attributes AttributeKey=EventName,AttributeValue=CancelInstanceRefresh \
  --start-time REFRESH_START_TIME --end-time REFRESH_END_TIME \
  --query 'Events[].{time:EventTime,user:Username,name:EventName}' \
  --output json --no-cli-pager

Repeat the CloudTrail lookup with RollbackInstanceRefresh for a manual rollback.

Two fictional outcomes#

The group orders-asg has ten instances. A refresh to launch template version 8 starts at 14:00 with MinHealthyPercentage 90, AutoRollback true, checkpoints at 20 and 100 percent with a 600-second delay, and the alarm orders-5xx in its alarm specification.

In the first outcome the refresh ends RollbackSuccessful at 14:31. RollbackDetails shows an automatic rollback started at 14:12 with PercentageCompleteOnRollback 20. Every launch activity is Successful, and the alarm history shows orders-5xx entering ALARM at 14:11, during the checkpoint pause. The alarm gate stopped the refresh. The alarm shows that the metric crossed its threshold while two version 8 instances served traffic; whether version 8 caused it needs a comparison of errors by instance or version.

In the second outcome the refresh ends Failed at 15:03 with no rollback, because this time AutoRollback was false. The activities show the same pattern every few minutes from 14:02: a version 8 launch succeeds, then the instance is terminated with the ELB health check cause. After an hour of retries the refresh gave up. Because nothing rolled back, read Instances[].LaunchTemplate.Version: any version 8 instance still running stays on version 8 until the next refresh. Read the health check guide to tell a short grace period from a broken release.

Afterwards: what to change and how to confirm#

Fix the gate first, then start a new refresh; a finished refresh cannot be rolled back. A rerun does not restart from the last checkpoint, and it targets instances on the earlier configuration first. Rollback, manual or automatic, needs a desired configuration in the refresh and a numbered launch template version on the group; AWS does not support it when the group uses $Latest, $Default or a Systems Manager parameter for the AMI. AWS says a rollback to a last saved configuration that is not stable still runs and eventually fails, so after RollbackFailed check that configuration with the launch template guide. Undo changes with a rollback · Checkpoints

Confirm on the new refresh: Status Successful, InstancesToUpdate 0, every instance's template ID and version equal to the target that applies to it, and the group's own LaunchTemplate or MixedInstancesPolicy updated to the target. For a mixed instances policy, the target for an instance is the override template for its type when the override carries one, and the policy's template otherwise.

Where this reading stops#

Refresh history and scaling activities go back six weeks. For a longer record, keep the EventBridge events AWS emits when a refresh starts, reaches a checkpoint, succeeds, fails or is cancelled. An alarm in ALARM establishes that a metric crossed a threshold, not that the release crossed it. PercentageComplete excludes instances replaced during a rollback and falls back toward zero as the rollback runs. A refresh can actively replace instances for at most 14 days. Other deployment signatures are in the signature table. Instance refresh events · InstanceRefresh

Questions#

Why did my instance refresh fail after about an hour?

When replacements keep failing health checks, or the refresh waits on instances in standby or protected from scale in, Auto Scaling retries for an hour and then fails the refresh. Read the scaling activities in that hour to see which.

Does a failed instance refresh roll back automatically?

Only if AutoRollback was true when it started; the default is false. Without it, instances already replaced keep the new configuration and the group keeps its previous settings.

What is the difference between a cancelled and a rolled-back instance refresh?

Cancelled stops further replacements and leaves replaced instances on the new configuration. RollbackSuccessful means Auto Scaling replaced those instances again with the group's last saved configuration.

One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. Eligibility and fair-use terms.

Start free with GitHub

Related reading