🟢

Auto Scaling Group – Instance Termination Policies

When an Auto Scaling Group (ASG) performs a scale-in event (reducing capacity), it decides which EC2 instances to terminate based on termination policies. By default, AWS follows these rules in order:
  1. Availability Zone Balancing – Ensures instances are evenly distributed across AZs; the ASG tries to keep balance by terminating in the AZ with the most instances.
  1. On-Demand vs Spot – If mixed, Spot Instances are terminated first to preserve On-Demand capacity.
  1. Instance Launch Configuration – Newer instances (latest launch configuration/template) are kept; older ones are candidates for termination.
  1. Billing Hour Consideration – Tries to maximize cost efficiency by selecting instances that are closest to the next billing hour (applies to some older pricing models).
  1. Default Random Selection – If multiple instances are equally eligible, one is chosen randomly.