Auto Scaling default Termination Policy

amazon ec2amazon-web-servicesautoscaling

Below I've pasted the default Termination Policy. This is what I find in the AWS documentation. But there is a problem with the 3rd step. It says that it chooses the instance closest to the next billing hour. Now that EC2 instances are billed to the second, this step is no longer valid. So how exactly does the default Termination Policy choose which instances to terminate? Do we just skip step 3?

(1) 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.

(2) Auto Scaling determines which unprotected instances in the selected Availability Zone use the oldest launch configuration. If there is one such instance, it terminates it.

(3) If there are multiple instances that use the oldest launch configuration, Auto Scaling determines which unprotected instances are closest to the next billing hour. (This helps you maximize the use of your EC2 instances and manage your Amazon EC2 usage costs.) If there is one such instance, Auto Scaling terminates it.

(4) If there is more than one unprotected instance closest to the next billing hour, Auto Scaling selects one of these instances at random.

Found on page: http://docs.aws.amazon.com/autoscaling/latest/userguide/as-instance-termination.html#default-termination-policy

Best Answer

My guess is that #3 and #4 no longer matter for On-Demand instances but will still matter for Spot instances.

However you should now customize the termination policy to select from:

OldestInstance. Auto Scaling terminates the oldest instance in the group. This option is useful when you're upgrading the instances in the Auto Scaling group to a new EC2 instance type. You can gradually replace instances of the old type with instances of the new type.

NewestInstance. Auto Scaling terminates the newest instance in the group. This policy is useful when you're testing a new launch configuration but don't want to keep it in production.

OldestLaunchConfiguration. Auto Scaling terminates instances that have the oldest launch configuration. This policy is useful when you're updating a group and phasing out the instances from a previous configuration.

Related Topic