DEV Community

Matt
Matt

Posted on • Originally published at fortem.dev

ECS Fargate vs ECS EC2: Which Launch Type Should You Use?

Fargate vs EC2 — same ECS orchestrator, two ways to run your containers. The choice is simpler than most people think, but the pricing math isn't.

Here's the honest comparison with real numbers and an interactive calculator.


The short answer

Choose Fargate for convenience — zero servers, pay per task, stop dev to $0 at night.

Choose EC2 for cost control — cheaper per-vCPU, but you manage instances. Or better: use both. ECS capacity providers let you mix them in the same cluster.


Where the costs actually diverge

  • Memory pricing: EC2 includes memory in the instance price. Fargate charges $0.00444/GB-hr separately. For 4 vCPU + 16 GB, Fargate is 43% more expensive than an equivalent m7g.xlarge.
  • HA at small scale: Fargate spreads tasks across AZs at per-task cost. EC2 needs ≥2 instances for production resilience — doubling the bill for a handful of services.
  • At scale EC2 wins: With 20+ services, bin-packing efficiency improves and EC2's per-vCPU savings compound (16–30% cheaper).

What's on the full page

  • Pricing table with 4 real scenarios
  • Interactive calculator (services, task size, instance type, On-Demand / Spot)
  • 6 hidden EC2 costs (AMI, ASG, agent, capacity planning, HA redundancy, OS security)
  • Spot comparison and Savings Plans depth
  • Capacity provider guide: run both, no Terraform rewrite

👉 Full comparison with cost calculator →

Data sources: AWS Fargate + EC2 pricing pages, Datadog Container Report 2023, AWS CLI spot-price-history (Jun 2026).

Top comments (0)