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

FeatureECS on EC2ECS on Fargate
Server ManagementYou manage EC2 instancesAWS manages everything
PricingPay for EC2 instances (even if idle)Pay per task (CPU + memory + time)
ScalingScale EC2 + tasksJust scale tasks
Best ForConsistent high workloadsVariable 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 Variables

Key Concepts Explained

ConceptWhat It IsAnalogy
ClusterLogical grouping of tasks and servicesA data center
Task DefinitionTemplate describing how to run containersA recipe
TaskOne running instance of a task definitionA dish made from the recipe
ServiceEnsures N tasks are always runningA 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:

ResourcePrice (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
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

WorkloadCPUMemoryUse Case
Micro256 (0.25 vCPU)512 MBSimple APIs, static sites
Small512 (0.5 vCPU)1024 MBNext.js apps, small services
Medium1024 (1 vCPU)2048 MBLarger apps, background workers
Large2048 (2 vCPU)4096 MBCompute-intensive workloads

AWS Deployment Guide — Built with Next.js