Skip to main content

πŸ›‘οΈ AWS ECS Cluster has spare EC2 capacity🟒

  • Contextual name: πŸ›‘οΈ Cluster has spare EC2 capacity🟒
  • ID: /ce/ca/aws/ecs/cluster-spare-capacity
  • Tags:
  • Policy Type: COMPLIANCE_POLICY
  • Policy Categories: COST, PERFORMANCE

Stats​

not available

Logic​

Description​

Open File

Description​

Identify Amazon ECS clusters with evidence of excess EC2 capacity for a fleet consolidation review. Fargate tasks use capacity managed separately from the registered EC2 fleet.

Rationale​

Persistent low reservation indicates few registered EC2 resources are allocated to tasks. Combined with an empty, connected host, it identifies a candidate for consolidation. Capacity provider targets, scheduled demand, placement constraints, and Availability Zone failover can justify keeping the headroom.

Audit​

This policy marks an AWS ECS Cluster as INCOMPLIANT if all of the following conditions hold.

  • Status is ACTIVE, Registered Container Instances Count and Running Tasks Count are positive, and Pending Tasks Count is zero.
  • CloudWatch: CPU Utilization, 14-Day and CloudWatch: Memory Utilization, 14-Day are both below 20%.
  • CloudWatch: CPU Reservation, 14-Day and CloudWatch: Memory Reservation, 14-Day are both below 40%.
  • At least one active container instance has a connected agent and a linked running EC2 instance. Its Running Tasks Count and Pending Tasks Count are both zero, and its Remaining Resources match its Registered Resources, including CPU and memory.

... see more

Remediation​

Open File

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.

... see more

policy.yaml​

Open File

Linked Framework Sections​

SectionSub SectionsInternal RulesPoliciesFlagsCompliance
πŸ’Ό Cloudaware Framework β†’ πŸ’Ό Resource Right-Sizing26no data
πŸ’Ό Cloudaware Framework β†’ πŸ’Ό Workload Efficiency31no data