Instance Maintenance Policy & Refresh Behavior

~8 min read

How an Auto Scaling Group replaces instances during a rolling update without dropping below minimum healthy capacity.

When an Auto Scaling Group's Launch Template is updated (a new AMI, a changed configuration) or an instance refresh is explicitly triggered, the group needs a policy for how to replace existing instances with new ones without creating a capacity gap. The instance maintenance policy controls this by defining minimum and maximum healthy percentage bounds during the replacement process — for example, a minimum healthy percentage of 90% and maximum of 110% means the group briefly launches a small number of extra instances on the new configuration before terminating old ones, ensuring capacity never drops below 90% of desired count at any point during the rollout, at the cost of briefly running slightly more instances (and paying for them) than the steady-state desired count. This is conceptually similar to the deployment strategies used elsewhere on AWS (like ECS rolling updates), applied specifically to EC2 Auto Scaling Groups replacing raw instances rather than containerized tasks.

💬 Deep Dive with AI

Key points

  • Instance maintenance policy controls min/max healthy percentage bounds during instance replacement
  • A minimum healthy percentage below 100% allows old instances to be terminated before all new ones are ready, trading brief reduced capacity for a faster/cheaper rollout
  • A maximum healthy percentage above 100% allows new instances to launch before old ones are terminated, avoiding any capacity dip at the cost of briefly running extra instances
  • Conceptually parallel to ECS's rolling update deployment strategy, applied to raw EC2 instances instead of containerized tasks