When creating an autoscaling group I can choose an ordered list of termination policies for its instances. Amazon's documentation states that
You can use these policies individually, or combine them into a list of policies that Auto Scaling uses when terminating instances.
But it glosses over the specifics of how these policies are combined and when the "fall through" happens to the next policy in the list, i.e. under what conditions each policy fails and moves on to the next policy in the list.
For example, I have a policy list ["OldestInstance", "Default"]
in my group and yet after scaling up and then down, the scaling group proceeded to terminate by newest (and healthy) instance (newer by a large margin), and I can't figure out why.
Additionally, according to the same doc, default policy is actually itself a combination of policies, and includes OldestLaunchConfiguration
and ClosestToNextInstanceHour
as two of its steps. If I have a list that includes ["OldestLaunchConfiguration", "ClosestToNextInstanceHour", "Default"]
, does it evaluate OldestLaunchConfiguration
and ClosestToNextInstanceHour
twice?
Lastly, does the termination consider load balancer? For example, if my new instance failed to initialise properly and is not in-service with the load balancer, and OldestInstance
is in effect, will scale-down action kill the unhealthy instance first even though it's newer?