Amazon ECS Fargate
Core Service
Run containers without managing servers
šµ Cost: Fargate charges per-second for vCPU + memory. A small task (0.25 vCPU, 0.5GB) running 24/7 costs ~$15/month.Stop services when not in use - Fargate only charges while tasks are running!
See our Costs & Cleanup Guide for deletion instructions.
What is ECS Fargate?
Amazon Elastic Container Service (ECS) runs your Docker containers in the cloud. Fargate is a serverless compute engine for ECS that lets you run containers without managing EC2 instances.
Why Fargate?
With Fargate, you just define how much CPU and memory your container needs. AWS handles provisioning servers, patching, scaling, and security updates. You only pay for the resources your containers actually use.
ECS vs Fargate vs EC2
| Feature | ECS on EC2 | ECS on Fargate |
|---|---|---|
| Server Management | You manage EC2 instances | AWS manages everything |
| Pricing | Pay for EC2 instances (even if idle) | Pay per task (CPU + memory + time) |
| Scaling | Scale EC2 + tasks | Just scale tasks |
| Best For | Consistent high workloads | Variable workloads, simplicity |
ECS Concepts
Plain Text
ECS Cluster
āāā Service (keeps N tasks running)
ā āāā Task (one running instance)
ā ā āāā Container (your Docker image)
ā āāā Task
ā āāā Task
ā
āāā Task Definition (blueprint for tasks)
āāā Image: 123456789.dkr.ecr.region.amazonaws.com/my-app:latest
āāā CPU: 256 (0.25 vCPU)
āāā Memory: 512 MB
āāā Port: 3000
āāā Environment VariablesKey Concepts Explained
| Concept | What It Is | Analogy |
|---|---|---|
| Cluster | Logical grouping of tasks and services | A data center |
| Task Definition | Template describing how to run containers | A recipe |
| Task | One running instance of a task definition | A dish made from the recipe |
| Service | Ensures N tasks are always running | A chef keeping dishes ready |
Fargate Pricing
Region-Specific Pricing
Prices shown are for ap-southeast-1 (Singapore). Prices vary by region. Always verify at aws.amazon.com/fargate/pricing. Last verified: January 2026.
Fargate charges per second for vCPU and memory:
| Resource | Price (ap-southeast-1) |
|---|---|
| vCPU per hour | ~$0.04048 |
| GB memory per hour | ~$0.004445 |
Example Cost
A small Next.js app (0.25 vCPU, 0.5GB RAM) running 24/7:
~$0.01/hour = ~$7.30/month per task
With 2 tasks for high availability: ~$14.60/month
~$0.01/hour = ~$7.30/month per task
With 2 tasks for high availability: ~$14.60/month
JSON
{
"family": "my-nextjs-app",
"networkMode": "awsvpc",
"requiresCompatibilities": ["FARGATE"],
"cpu": "256",
"memory": "512",
"containerDefinitions": [
{
"name": "app",
"image": "123456789.dkr.ecr.ap-southeast-1.amazonaws.com/my-app:latest",
"portMappings": [
{
"containerPort": 3000,
"protocol": "tcp"
}
],
"environment": [
{
"name": "NODE_ENV",
"value": "production"
}
],
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "/ecs/my-nextjs-app",
"awslogs-region": "ap-southeast-1",
"awslogs-stream-prefix": "ecs"
}
}
}
]
}Common Fargate Sizes
| Workload | CPU | Memory | Use Case |
|---|---|---|---|
| Micro | 256 (0.25 vCPU) | 512 MB | Simple APIs, static sites |
| Small | 512 (0.5 vCPU) | 1024 MB | Next.js apps, small services |
| Medium | 1024 (1 vCPU) | 2048 MB | Larger apps, background workers |
| Large | 2048 (2 vCPU) | 4096 MB | Compute-intensive workloads |