Fargate Pricing
Fargate bills per vCPU and per GB of memory, per second, for the life of each task.
With Fargate you pay for the vCPU and memory you request, billed per second (one-minute minimum), from image pull until the task stops.
What drives the bill
- The
cpuandmemoryin the task definition. - How long tasks run and how many run at once.
- Optional Spot capacity, which is much cheaper for interruption-tolerant work.
Because you pay for what you request, right-sizing CPU and memory directly lowers cost.
Example
# Fargate Spot can cut cost sharply for fault-tolerant tasks
aws ecs run-task \
--cluster prod \
--capacity-provider-strategy capacityProvider=FARGATE_SPOT,weight=1 \
--task-definition batch:3When to use it
- A FinOps engineer calculates that running ten 0.5 vCPU / 1 GB Fargate tasks for 8 hours will cost less than keeping two t3.medium EC2 instances running all day.
- A team switches batch workloads to Fargate Spot and reduces their monthly compute bill by 60% by tolerating occasional 2-minute interruption notices.
- A developer checks the Fargate per-second billing model to confirm that a nightly 3-minute task costs only fractions of a cent per run.
More examples
Estimate Fargate Task Cost
Manually calculates the Fargate cost for a 0.5 vCPU / 1 GB task running 8 hours using the published per-vCPU and per-GB hourly rates.
# Fargate pricing (us-east-1, approximate):
# vCPU: $0.04048 per vCPU-hour
# Memory: $0.004445 per GB-hour
#
# Example: 0.5 vCPU, 1 GB, running 8 hours:
# CPU cost: 0.5 * 8 * 0.04048 = $0.162
# Memory cost: 1.0 * 8 * 0.004445 = $0.036
# Total: $0.198 for 8 hours
python3 -c "print(f'CPU: \${0.5*8*0.04048:.4f}, Mem: \${1.0*8*0.004445:.4f}')"Enable Fargate Spot for Batch Jobs
Runs batch processor tasks entirely on Fargate Spot to take advantage of up to 70% cost savings for interruption-tolerant workloads.
aws ecs create-service \
--cluster batch-cluster \
--service-name nightly-processor \
--task-definition batch-job:4 \
--desired-count 5 \
--capacity-provider-strategy \
'[{"capacityProvider":"FARGATE_SPOT","weight":1}]' \
--network-configuration \
'awsvpcConfiguration={subnets=[subnet-a],securityGroups=[sg-batch],assignPublicIp=DISABLED}'Tag Tasks for Cost Allocation
Adds cost-allocation tags to a Fargate task so AWS Cost Explorer can break down Fargate spend by team and environment.
aws ecs run-task \
--cluster prod \
--launch-type FARGATE \
--task-definition api:7 \
--enable-ecs-managed-tags \
--propagate-tags TASK_DEFINITION \
--tags key=Team,value=backend key=Env,value=prod \
--network-configuration \
'awsvpcConfiguration={subnets=[subnet-a],securityGroups=[sg-api],assignPublicIp=DISABLED}'
Discussion