AWS Auto Scaling Group Termination Policy Explained

Default Auto Scaling Termination Policy

Prev Question Next Question

Question

You have an Auto Scaling group with 2 AZs.

One AZ has 4 EC2 instances, and the other has 3 EC2 instances.

None of the instances are protected from scale in.

Based on the default Auto Scaling termination policy, what will happen?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Answer - D.

The default termination policy is designed to help ensure that your network architecture spans Availability Zones evenly.

When using the default termination policy, Auto Scaling selects an instance to terminate as follows.

Auto Scaling determines whether there are instances in multiple Availability Zones.

If so, it selects the Availability Zone with the most instances and at least one instance that is not protected from scale in.

If there is more than one Availability Zone with this number of instances, Auto Scaling selects the Availability Zone with the instances that use the oldest launch configuration.

For more information on Autoscaling instance termination, please refer to the below link:

http://docs.aws.amazon.com/autoscaling/latest/userguide/as-instance-termination.html

In an Auto Scaling group, the default termination policy is used when no specific termination policy is specified. The default policy is designed to balance the number of instances across Availability Zones, and it follows the following steps:

  1. Select the Availability Zone with the highest number of instances.
  2. If there are multiple Availability Zones with the same highest number of instances, select one of those zones randomly.
  3. Select the instance from the selected Availability Zone with the oldest launch configuration, since it is assumed that older instances may have accumulated more technical debt, and therefore may be less resilient.
  4. If there are multiple instances with the same oldest launch configuration, select one of those instances randomly.

Based on this default termination policy, the answer to the question is D. Since one Availability Zone has 4 instances and the other has 3, the zone with 4 instances has the highest number of instances. Therefore, Auto Scaling will select this zone and terminate an instance from it. Since there is no protection from scale in, the specific instance to be terminated will be selected randomly.

It's worth noting that you can customize your termination policy by defining your own criteria to determine which instances to terminate. In some cases, you may want to prioritize instances based on specific criteria, such as cost, performance, or application dependencies.