Skip to main content

Remediation

Reduce Spare ECS Cluster Capacity​

  1. Review CPU and memory reservation and utilization across a representative workload cycle. Check peak and scheduled demand, deployment headroom, and Availability Zone failover.
  2. Identify the EC2 capacity provider or Auto Scaling group that owns the spare host. Confirm that the remaining hosts can place the workload, including tasks with port, ENI, GPU, or host-specific requirements.
  3. Record the current capacity provider and group settings. Review managed draining and scale-in protection. For infrastructure managed through code, apply the change through the existing deployment process.

Using the AWS CLI​

  1. Inspect the capacity provider's managed scaling settings and backing Auto Scaling group.

    aws ecs describe-capacity-providers \
    --region {{region}} \
    --capacity-providers {{capacity-provider-name}}
  2. If the Auto Scaling group minimum is keeping verified spare capacity online, lower it to the minimum required for the workload.

    aws autoscaling update-auto-scaling-group \
    --region {{region}} \
    --auto-scaling-group-name {{auto-scaling-group-name}} \
    --min-size {{verified-minimum-capacity}}
  3. If ECS managed scaling is keeping more spare capacity than the workload needs, raise the provider's target utilization while preserving the headroom verified in the review. Prepare the update file with the new targetCapacity value and preserve the remaining scaling, draining, and termination protection settings. Leave desired capacity under ECS managed scaling. Amazon ECS cluster auto scaling

    aws ecs update-capacity-provider \
    --region {{region}} \
    --name {{capacity-provider-name}} \
    --auto-scaling-group-provider file://{{capacity-provider-update-file}}

For a self-managed group or standalone host, follow the existing draining and scale-in procedure. Confirm which hosts can be removed and allow standalone tasks to finish or move them through their workload's recovery procedure before removing a host. Draining ECS container instances

Verify the Change​

  1. Confirm that the expected EC2 capacity was removed, remaining tasks are healthy, and the cluster can place tasks during typical peaks and deployments.
  2. Restore the recorded minimum, scaling target, or fleet settings if tasks remain pending or service health degrades. Verify that replacement capacity registers and can accept tasks.
  3. Estimate savings from the EC2 capacity actually removed. Count the same fleet reduction once across cluster, host, and service findings.