Description:
When an ECS Capacity Provider with ManagedTerminationProtection enabled is deleted, the ProtectedFromScaleIn flags that ECS set on the associated Auto Scaling Group instances are never removed. This leaves instances permanently protected from scale-in, which blocks ASG deletion and causes CloudFormation stack delete operations to fail.
Expected behavior:
When a Capacity Provider is deleted (or disassociated from a cluster), ECS should remove the ProtectedFromScaleIn flag from all instances in the associated ASG that were protected by ECS managed termination protection. Since ECS is removing its association with the ASG, its lifecycle hooks will no longer manage those instances, and the protection flags are no longer meaningful.
Current behavior:
- Customer creates a Capacity Provider with ManagedTerminationProtection: ENABLED and associates it with an ASG
- ECS sets ProtectedFromScaleIn=true on ASG instances
- Customer deletes the Capacity Provider
- Instance-level scale-in protection flags remain set on the ASG instances
- The ASG cannot be deleted (CloudFormation returns ScalingActivityInProgress or similar), blocking stack cleanup
Impact:
Customers using CloudFormation or CDK to manage ECS infrastructure with capacity providers cannot cleanly tear down their stacks. The only workaround is to manually remove scale-in protection from each instance via the Auto Scaling API before retrying the stack deletion.
Related: aws-cdk#18179
Description:
When an ECS Capacity Provider with ManagedTerminationProtection enabled is deleted, the ProtectedFromScaleIn flags that ECS set on the associated Auto Scaling Group instances are never removed. This leaves instances permanently protected from scale-in, which blocks ASG deletion and causes CloudFormation stack delete operations to fail.
Expected behavior:
When a Capacity Provider is deleted (or disassociated from a cluster), ECS should remove the ProtectedFromScaleIn flag from all instances in the associated ASG that were protected by ECS managed termination protection. Since ECS is removing its association with the ASG, its lifecycle hooks will no longer manage those instances, and the protection flags are no longer meaningful.
Current behavior:
Impact:
Customers using CloudFormation or CDK to manage ECS infrastructure with capacity providers cannot cleanly tear down their stacks. The only workaround is to manually remove scale-in protection from each instance via the Auto Scaling API before retrying the stack deletion.
Related: aws-cdk#18179