Certopolis

AWS Certified CloudOps Engineer – Associate

Auto Scaling instance refresh: healthy percentage, rollback

The EC2 Auto Scaling User Guide says an instance refresh replaces instances in batches set by the minimum and maximum healthy percentages of desired capacity. The defaults without an instance maintenance policy are 90 and 100 percent. A refresh can be rolled back only while it is in progress; afterwards you start a new refresh.

How do the healthy percentages control the batches?

The minimum healthy percentage is the share of desired capacity that must stay in service and healthy for the refresh to continue. The maximum healthy percentage is how far above desired capacity the group may grow while replacing. The difference between them cannot exceed 100.

With 90 and 100, 10 percent of capacity is replaced at a time and the group never grows. With both at 100, the refresh launches a new instance before terminating an old one, one at a time, so capacity never falls below desired. A minimum of 0 replaces everything at once.

After a new instance passes health checks, the refresh waits for the instance warmup before it moves on. If an instance maintenance policy is set on the group, the percentages come from it unless you override them.

What do bake time, checkpoints and skip matching do?

Bake time is a wait at the end of the refresh before it counts as complete. Its default is zero. Checkpoints pause the refresh after set percentages so you can verify; the default delay is one hour and they are off by default.

Skip matching leaves alone instances that already match the desired configuration. It is on by default in the console and off by default with the AWS CLI or an SDK.

When the refresh succeeds, Auto Scaling updates the group's settings to the desired configuration. During the refresh, any scale-out launches instances with the desired configuration.

When can you roll back?

You can roll back a refresh that is still in progress. You cannot roll it back after it has finished; to go back then, start a new instance refresh with the old configuration.

Rollback needs a desired configuration in the refresh, and the launch template version must be a specific number. It is not available with $Latest or $Default.

Auto rollback is off by default. With it on, the refresh reverses itself when it fails or when a CloudWatch alarm you named goes into ALARM. If you name an alarm without enabling auto rollback, the refresh fails without rolling back. The alarm only matters while the refresh is running, which is why a bake time keeps the window open after the last replacement.

Where the exam catches people

  • Trying to roll back a finished instance refresh: rollback exists only while the refresh is in progress. Start a new refresh instead.
  • Believing the default refresh launches before it terminates: that happens only when the minimum healthy percentage is 100.
  • Expecting an alarm to trigger rollback after the last instance is replaced: with the default bake time of zero the refresh is already complete.
  • Using $Latest in the group and expecting rollback: rollback needs a specific numbered launch template version.
  • Attaching an alarm and assuming rollback follows: without auto rollback enabled the refresh only fails.

Written from these sources

Try 3 questions on this

Pick an answer to see why each option is right or wrong.

  1. An Auto Scaling group runs 20 instances of a licensed application, and the licence allows no more than 20 instances to run at any moment. The SysOps administrator will start an instance refresh to roll out a new launch template version and wants each batch to replace two instances. Which solution will meet these requirements?

    Right. In the game that’s Renown for your Deployment, Provisioning, and Automation building.

    Not that one: C is right. In the game your Deployment, Provisioning, and Automation building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    With 90 percent, 18 instances keep serving, so two old instances can be out at once. With 100 percent as the ceiling, the group never launches anything beyond the 20 that the licence allows. Every batch therefore retires two old instances and brings up two new ones.

    Written from docs.aws.amazon.com/autoscaling/ec2/userguide/instance-refresh-overview.html

  2. An Auto Scaling group of 24 instances launches from launch template version 7. At 10:00 the SysOps administrator started an instance refresh with version 8 as its desired configuration and auto rollback turned on, and the refresh finished at 10:40. At 11:30 a memory leak in version 8 begins to fail requests, and every instance must go back to version 7. Which action should the SysOps administrator take to meet this requirement?

    Right. In the game that’s Renown for your Deployment, Provisioning, and Automation building.

    Not that one: D is right. In the game your Deployment, Provisioning, and Automation building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    The way back is a new instance refresh whose desired configuration names version 7: it replaces the version 8 instances in batches under the group's healthy-percentage limits and, when it succeeds, saves version 7 on the group again.

    Written from docs.aws.amazon.com/autoscaling/ec2/userguide/instance-refresh-rollback.html

  3. An Auto Scaling group's instance refreshes run with auto rollback turned on and the load balancer's 5XX alarm attached. Last week the alarm entered the ALARM state 15 minutes after a refresh replaced its final instance, and nothing was rolled back. Errors in the 30 minutes after the final replacement must also return the group to its previous configuration automatically. Which solution will meet these requirements?

    Right. In the game that’s Renown for your Deployment, Provisioning, and Automation building.

    Not that one: C is right. In the game your Deployment, Provisioning, and Automation building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    A 30-minute bake time keeps the refresh open for that long after the last replacement, and an ALARM state inside that window still fails the refresh and sends the group back to the configuration it had before.

    Written from docs.aws.amazon.com/autoscaling/ec2/userguide/understand-instance-refresh-default-values.html

Ask for something