All cheat sheets
Computecheat sheet

ECS Capacity Providers

Blend Spot and On-Demand EC2 (and Fargate Spot) behind an ECS cluster with a base+weight strategy — 60–80% off container compute while an On-Demand baseline keeps you reliable. Diversify Spot pools; keep base on On-Demand only.

Last reviewed: July 14, 2026

TL;DR: ECS Capacity Providers (Nov 2019) let you blend Spot and On-Demand behind a cluster and declare how tasks distribute across them with a base + weight strategy — "always run at least N tasks on On-Demand, spread the rest mostly across Spot." ECS handles placement and, on a 2-minute Spot interruption, drains and reschedules to other pools or On-Demand. For stateless containers at scale it's one of the highest-ROI optimizations in AWS: 60–80% off container compute while the On-Demand baseline keeps you reliable.

The numbers

  • Spot is 70–90% off On-Demand (fluctuates; set a max price if needed); the base+weight strategy sets the reliability/cost balance.
  • base = minimum tasks always on a provider (use On-Demand only); weight = proportional share of the rest. 10 tasks with On-Demand base=2, then weight 1:4:4 across On-Demand/Spot-A/Spot-B → 2 guaranteed + 8 across Spot.
  • Stacks with other levers — teams combining Capacity Providers + Compute Savings Plans + Compute Optimizer rightsizing + auto scaling report 75–85% total reductions.
  • Field examples: a 100+ microservice e-commerce API at 80/20 Spot with 15 instance types cut 65% (~$32K/mo) at ~3% weekly interruption and zero customer outages; a nightly ETL pipeline (10% On-Demand base, 90% Spot, S3 checkpoints every 10 min) cut 70%.

Do this

  1. Start conservative (30% Spot, 70% On-Demand), monitor a week, then ramp to 50/50 and 70/30 as confidence builds — Capacity Providers add to existing clusters without disrupting running tasks.
  2. Diversify Spot aggressively — 10+ instance types across families/AZs (separate ASG-backed providers or multiple types per ASG) with capacity-optimized allocation; more pools = fewer interruptions.
  3. Set base on On-Demand only — never give a Spot provider a base, so your critical floor always lands on reliable compute.
  4. Design for graceful restarts — health checks, clean SIGTERM handling, and S3 checkpointing for batch (without checkpoints, interrupted jobs restart from scratch and negate the savings).
  5. Test interruptions before production — terminate Spot instances in staging and watch task churn; add Fargate Spot as another provider for extra flexibility.

Gotchas

  • 100% Spot risks simultaneous interruptions taking down the whole service — always keep an On-Demand base for critical baseline.
  • Managed scaling can be quirky (scale-out delays, scale-in hesitation) — some teams disable it and scale the ASG separately.
  • Savings vary by region/timing — Spot occasionally nears On-Demand price; monitor and set max prices.
  • More moving parts — multiple ASGs, providers, and strategies is real added complexity; start with one Spot provider.

Skip this if

  • The service is single-task-critical, has slow startup (>3 min), or a strict latency SLA — run it On-Demand (or a very high On-Demand base); some things aren't worth the interruption risk.
  • Batch jobs can't checkpoint — Spot restarts negate the savings. Pair with Fargate Spot for serverless containers, ECS Service Auto Scaling to run only what's needed, and stack Compute Savings Plans on the On-Demand portion.

Run this audit with your AI assistant

Paste this into Claude, ChatGPT, or any agent that can run the AWS CLI with read-only credentials. It audits your account for exactly the waste this sheet describes — and changes nothing.

You are auditing an AWS account's ECS clusters for Capacity Provider
(Spot/On-Demand blend) savings. Use the AWS CLI with READ-ONLY
credentials. Do not create, modify, or delete anything — report findings
and recommended (unapplied) fixes only.

1. Inventory: aws ecs describe-clusters --include ATTACHMENTS and
   describe-capacity-providers — capture providers (ASG-backed vs Fargate/
   Fargate Spot), and per-service capacityProviderStrategy (base + weight
   per provider). Flag services running 100% On-Demand.
2. Spot readiness: identify stateless/idempotent services that tolerate
   the 2-minute drain; exclude single-task-critical, slow-startup (>3 min),
   and strict-latency-SLA services.
3. Diversification: flag ASG-backed Spot providers pinned to few instance
   types; recommend 10+ across families/AZs and capacity-optimized
   allocation. Flag any `base` set on a Spot provider (base belongs on
   On-Demand only).
4. Savings: estimate current On-Demand $/mo vs an 80/20 Spot/On-Demand
   blend (~60-70% off the Spot portion).

Report a table: cluster/service | current strategy | Spot-ready? | #Spot
types | recommended base/weight | est. $/mo saved. Change nothing.
Works with any assistant that can run shell commands.

Want the guided version?

The ECS Capacity Providers walkthrough covers this topic interactively — it asks about your setup, branches to what’s relevant, and quizzes you on the tricky parts. Free and anonymous.

Start the walkthrough