Amazon ECS itself is free; compute is not
Amazon Elastic Container Service (Amazon ECS) has no charge for orchestration. According to the Amazon ECS pricing page, you pay only for the compute and other AWS resources your tasks use. The cost question is therefore which compute option runs your tasks:

- AWS Fargate: serverless compute. You pay for the CPU, memory and storage each task requests, and there are no instances to manage.
- Amazon EC2: you run container instances in an Auto Scaling group and pay normal EC2 prices for them, however full or empty they are.
- Amazon ECS Managed Instances: a newer middle option. AWS provisions, patches and scales EC2 instances for you and places multiple tasks per instance. You pay EC2 charges plus a management fee, as described on the ECS pricing page.
How Fargate is billed
Fargate charges for what each task requests, not for what it uses. The AWS Fargate pricing page lists the dimensions:
- vCPU and memory per hour, at rates that depend on the Region, the operating system and the CPU architecture.
- Ephemeral storage above the 20 GB each task gets by default.
- Billing granularity: per second with a one-minute minimum for Linux tasks; Windows tasks have a five-minute minimum.
Task sizes come in fixed CPU and memory combinations, from 0.25 vCPU with 512 MiB up to large Linux tasks, listed in the Fargate task definition guide. If your application needs 0.6 vCPU, you pay for 1 vCPU. Right-sizing task definitions from real CloudWatch or Container Insights data is the single biggest Fargate saving.
How EC2 is billed
On EC2 you pay for instances, their Amazon EBS volumes and any public IPv4 addresses, whether tasks fill them or not. Compare the per-vCPU and per-GB rates on both pricing pages for your Region: EC2 can work out cheaper per unit of capacity, but only if the instances are well used. An instance running at 40 percent utilization means you are paying for the empty 60 percent. EC2 also gives you options Fargate does not, such as GPU instances and instance types with large local storage or high network bandwidth.
Discounts apply to both
A common mistake is assuming Reserved Instances and Spot are EC2-only advantages. Most discount mechanisms have a Fargate equivalent:
- Compute Savings Plans cover Amazon EC2, AWS Fargate and AWS Lambda usage in exchange for a one- or three-year commitment, according to the Compute Savings Plans pricing page. For Fargate, the discount applies to the vCPU and memory dimensions. The Fargate pricing page states savings of up to 50 percent on Fargate usage.
- EC2 Instance Savings Plans and Reserved Instances apply to EC2 only, and give larger discounts for committing to an instance family in a Region.
- Fargate Spot runs interruption-tolerant tasks on spare capacity at up to a 70 percent discount off the Fargate price, according to the Fargate pricing page. Tasks get a two-minute warning, delivered as a
SIGTERMand an Amazon EventBridge task state change event, before they stop. Fargate Spot is not available for Windows containers. - EC2 Spot Instances offer discounts for interruptible EC2 capacity. ECS can drain Spot container instances when it receives an interruption notice if you enable Spot instance draining on the ECS container agent.
- Graviton. Fargate and EC2 both support Arm-based AWS Graviton processors. On Fargate, the Linux/Arm vCPU and memory rates are lower than the Linux/x86 rates on the pricing page; on EC2, Graviton instance families are priced separately. Check that your images and dependencies build for
ARM64first.
Capacity providers and mixing options
Capacity providers let one service split tasks across capacity types. For Fargate, the FARGATE and FARGATE_SPOT providers can share a service with a base and weight:
"capacityProviderStrategy": [
{ "capacityProvider": "FARGATE", "base": 2, "weight": 1 },
{ "capacityProvider": "FARGATE_SPOT", "weight": 3 }
]
Here the first two tasks always run on regular Fargate, and additional tasks are split one to three between Fargate and Fargate Spot. A capacity provider strategy cannot mix Fargate providers with Auto Scaling group providers, but one cluster can contain both kinds.
For EC2, an Auto Scaling group capacity provider with managed scaling lets ECS scale the group based on the tasks waiting to be placed, and managed termination protection stops the group from removing instances that still run tasks. Together, they keep instance counts close to what your tasks need.
Bin packing on EC2
EC2 savings depend on packing tasks efficiently. Useful levers:
- Use the
binpackplacement strategy on memory or CPU so ECS fills instances before starting new ones, where your availability needs allow it. - Choose instance sizes that fit your common task shapes, so leftover capacity is small.
- Consider attribute-based instance type selection or several instance types per Auto Scaling group, which also improves Spot availability.
- Remember that the
awsvpcnetwork mode gives each task its own elastic network interface, and instances have ENI limits. ENI trunking raises that limit on supported instance types.
Costs that are not on the price list
The compute bill is not the whole cost. Include:
- Operations. On EC2 you patch AMIs, upgrade the ECS agent, tune Auto Scaling and respond to instance issues. Someone’s time has a price. Fargate and ECS Managed Instances shift most of that work to AWS.
- Idle headroom. EC2 clusters usually keep spare capacity so new tasks can start quickly; Fargate does not need it.
- Networking and logging. NAT gateway data processing, cross-AZ data transfer, public IPv4 addresses and CloudWatch Logs ingestion apply to both options and can rival the compute cost for chatty services.
- Startup time. Fargate tasks pull their image every time they start, so large images slow scale-out. Smaller images, or Seekable OCI (SOCI) indexes for lazy loading, help.
Choosing between them
A practical rule of thumb:
- Choose Fargate for spiky or unpredictable workloads, small teams, scheduled jobs and services that scale to low counts, where paying per task beats paying for idle instances. Add Compute Savings Plans for the steady baseline and Fargate Spot for interruption-tolerant work.
- Choose EC2 for large, steady fleets you can pack densely, workloads that need GPUs or specific instance types, and teams already running EC2 operations well. Combine Savings Plans or Reserved Instances for the base with Spot for flexible capacity.
- Evaluate ECS Managed Instances when you want EC2 instance choice and multi-task packing without managing the instances yourself.
Whatever you choose, measure. Tag services, enable split cost allocation data in your Cost and Usage Report to see cost per ECS task, and compare cost per task or per request before and after a change.
9Acts is an AWS Advanced Tier Services Partner and AWS MSP Partner with 100+ AWS certifications across the team. If you want a second look at your container costs, see our cloud optimization services or contact us.
