AWS ECS Pricing & Cost Guide (EC2 vs Fargate drivers)
ECS cost is mainly the cost of the compute you run on plus the infrastructure around it. The two common models are ECS on EC2 launch type (you pay for instances) and ECS on Fargate (you pay for vCPU-hours + memory GB-hours per running task).
1) Compute (baseline)
- EC2 launch type: instance-hours, plus EBS if you attach volumes.
- Fargate: vCPU-hours + memory GB-hours, scaled by running tasks.
- Idle matters: for EC2, paying for idle capacity is often the largest hidden multiplier.
2) Load balancers (baseline + capacity units)
- ALB/NLB hourly baseline per load balancer.
- Capacity units (LCU/NLCU) driven by connections, throughput, and rule evaluations.
- One load balancer per service can create a large baseline even when services are quiet.
3) Logs and metrics
- Log ingestion grows with request volume and verbosity.
- Retention creates a steady GB-month baseline.
- Query scans spike during incidents and heavy dashboards.
- Metrics costs grow with custom metric cardinality and polling.
4) Networking (NAT, egress, cross-AZ)
- NAT gateway: hourly + GB processed can dominate private subnet workloads.
- Internet egress: bytes leaving AWS to users/external systems.
- Cross-AZ transfer: microservice chatter and uneven placement can create internal transfer.
5) Storage (when you run on EC2)
- EBS volumes (GB-month + optional IOPS/throughput).
- Snapshots (change rate x retention).
- Stateful dependencies often dwarf the service compute line item.
6) Registry behavior (ECR)
- Storage grows with retention and CI push frequency.
- Pull traffic spikes during cluster autoscaling and cold starts.
- Cross-region pulls and NAT paths can change transfer costs materially.
Rule of thumb (sanity check)
If your service is quiet but your bill is high, look for baselines: load balancer hourly, NAT hourly, and retention (logs, snapshots, registry). If your traffic spikes, look for variable drivers: logs, transfer, and capacity units.
Validation checklist
- Validate average (not peak) running tasks and the busy-month scenario.
- Validate log ingestion GB/day and retention settings for each service.
- Validate NAT processed GB and egress GB for the real traffic paths.
- Validate load balancer count and whether they are shared across services.
Sources
- ECS pricing: aws.amazon.com/ecs/pricing
- Fargate pricing: aws.amazon.com/fargate/pricing
Related guides
ECS EC2 vs Fargate Cost Comparison
Compare ECS on EC2 vs Fargate using compute, storage, and networking drivers. When each model is cheaper.
Fargate vs EC2 cost: how to compare compute, overhead, and hidden line items
A practical Fargate vs EC2 cost comparison: normalize workload assumptions, compare unit economics (vCPU/memory-hours vs instance-hours), and include the line items that change the answer (idle capacity, load balancers, logs, transfer).
AWS Fargate pricing (cost model + pricing calculator)
A practical Fargate pricing guide and calculator companion: what drives compute cost (vCPU-hours + GB-hours), how to estimate average running tasks, and the non-compute line items that usually matter (logs, load balancers, data transfer).
ECS cost model beyond compute: the checklist that prevents surprise bills
A practical ECS cost model checklist beyond compute: load balancers, logs/metrics, NAT/egress, cross-AZ transfer, storage, and image registry behavior. Use it to avoid underestimating total ECS cost.
Fargate cost optimization (high-leverage fixes)
A practical Fargate cost optimization checklist: rightsize tasks, scale on real signals, reduce idle capacity, and avoid hidden networking and logging costs.
Fargate vs EKS cost: what usually decides the winner
A practical Fargate vs EKS cost comparison: normalize workload assumptions, compare task-hours vs node-hours, include EKS fixed overhead (cluster fee + add-ons), and account for the line items that dominate both (LBs, logs, transfer).
FAQ
Does ECS itself have a separate charge?
Most ECS bills are dominated by underlying compute (EC2 or Fargate) plus networking and logs. The best model is compute plus the infrastructure around it.
What's the biggest ECS modeling mistake?
Comparing only compute list prices while ignoring load balancers, NAT/egress, and log ingestion/retention. These line items often dominate for real services.
Last updated: 2026-02-23