How do I resolve the error "The managed termination protection setting for the capacity provider is invalid" in Amazon ECS?

Last updated: 2020-05-14

When I try to create a cluster capacity planner in Amazon Elastic Container Service (Amazon ECS), I get the following error: "The managed termination protection setting for the capacity provider is invalid. To enable managed termination protection for a capacity provider, the Auto Scaling group must have instance protection from scale in enabled."

How can I resolve this error?

Resolution

To resolve the error, enable scale-in protection on your Auto Scaling group:

1.    Open the Amazon Elastic Compute Cloud (Amazon EC2) console.

2.    From the navigation pane, choose Auto Scaling Groups, and then select your Auto Scaling group.

3.    Choose Actions, and then choose Edit.

4.    For Instance Protection, choose Protect From Scale In.

5.    Choose Save.

If you still receive the error, then some of your existing instances launched by the Auto Scaling group might not have scale-in protection.

To apply scale-in protection to the remaining instances, complete the following steps in either the Amazon EC2 console or AWS Command Line Interface (AWS CLI).

Using the Amazon EC2 console:

1.    Open the Amazon EC2 console.

2.    From the navigation pane, choose Auto Scaling Groups, and then select your Auto Scaling group.

3.    Choose the Instances tab.

4.    In the Instance ID column, select the instances to apply scale-in protection to.

5.    On the Instances tab, choose Actions, Instance Protection, Set Scale In Protection.

6.    Create a capacity provider in Amazon ECS.

Using the AWS CLI:

1.    In the AWS CLI, run the following command:

# aws autoscaling set-instance-protection --region us-east-1 --instance-ids yourInstanceID --auto-scaling-group-name yourASGName --protected-from-scale-in

Replace us-east-1 with your AWS Region. Replace yourInstanceID with your instance ID. Replace yourASGName with the name of your Auto Scaling group.

2.    Create a capacity provider in Amazon ECS.


Did this article help you?

Anything we could improve?


Need more help?