1
votes

I am making an AWS ECS cluster using EC2 and trying to use capacity providers. I don't really understand why do I need to enable instance scale-in protection inside my AWS Auto Scaling group. Isn't the point of Auto Scaling the termination of needless EC2 instances?

1

1 Answers

5
votes

why do I need to enable instance scale-in protection

This is only needed when you chose to use managed scaling:

When managed scaling is enabled, Amazon ECS manages the scale-in and scale-out actions of the Auto Scaling group used when creating the capacity provider. On your behalf, Amazon ECS creates an AWS Auto Scaling scaling plan with a target tracking scaling policy based on the target capacity value you specify.

The manged scaling ensures that ECS controlled when instances are removed. By doing this it protects any instances that has some tasks running on it from being terminated:

When managed termination protection is enabled, Amazon ECS prevents Amazon EC2 instances that contain tasks and that are in an Auto Scaling group from being terminated during a scale-in action.

The the entire idea is that you enable instance scale-in protection on your ASG so that ECS has control over which instances to terminate based on tasks they run. Without this, your ASG could terminate instances based on other criteria, not nervelessly related to "needless EC2 instances". For example ASG can choose to terminate instances based due to AZRebalance process. Thus could lead to ASG terminating instances with running tasks, which may not be what you want.