All checks
Medium ECS · regional

ECS capacity providers should have managed termination protection enabled

Checks that each ECS capacity provider backed by an Auto Scaling group has managed termination protection enabled; Fargate providers are skipped. With it, a scale-in terminates only instances running no ECS tasks, rather than instances whose tasks are still running.

service
ECS
severity
Medium
scope
evaluated in every region

How to fix it

In the console

ECS → Clusters → the cluster → Infrastructure → the capacity provider → Update → Auto Scaling group settings

Managed termination protection
Turned on
Managed scaling
Turned on as well; managed termination protection has no effect without it
Instance scale-in protection (on the Auto Scaling group)
Turned on first, or instances can be left stuck draining

With the AWS CLI

aws ecs update-capacity-provider --name <capacity-provider-name> --auto-scaling-group-provider managedTerminationProtection=ENABLED --region <region>

With Terraform

resource "aws_ecs_capacity_provider" "this" {
  name = "example"

  auto_scaling_group_provider {
    auto_scaling_group_arn         = var.auto_scaling_group_arn
    managed_termination_protection = "ENABLED"

    managed_scaling {
      status = "ENABLED"
    }
  }
}

See which of your accounts this check is failing on.

Book a live scan