Infra Atlas · Decisions

Fargate or EC2 for ECS?

Serverless containers, or containers on instances you run yourself.

Reviewed
The verdict

Pick Fargate for zero infrastructure management, spiky workloads, or simply getting started — you pay per vCPU-second the task requests and AWS owns the host. Pick the EC2 launch type for large, steady, high-utilisation workloads that must be price-optimised, or anything needing GPUs, privileged containers, daemon workloads, or custom AMIs. The deciding factor is steady-state utilisation and host control: high predictable load plus any host-level need points to EC2; everything else favours Fargate.

Decide interactively

Answer the questions — the helper scores both the options against the sourced table below and shows its reasoning. A heuristic, not an oracle: the verdict above stays the authority.

What does steady-state utilisation look like?
GPUs, privileged containers, DAEMON tasks or custom AMIs?
Who should own the hosts?
Does per-task isolation matter?
Head to head
CriterionFargateEC2 launch type
Host managementAWS — no provisioning, patching or scalingYou — instance choice, config, maintenance
Pricing modelPer-second, on the vCPU + memory the task requestsThe EC2 instances you run — used or idle
Cost at steady high loadLess efficient — billed per task, not per packed hostCheaper — pack instances to high utilisation
GPU supportNot supportedYes — EC2 GPU instances + the GPU-optimized AMI
Privileged / daemon tasksNo — privileged and the DAEMON strategy unsupportedYes — privileged containers and DAEMON tasks
Host accessNone — no SSH, no custom AMIFull — SSH, custom AMIs, instance-type choice
Networking modesawsvpc only — one ENI per taskawsvpc, bridge or host
IsolationEach task in its own kernel / CPU / memory boundaryTasks on an instance share that instance's kernel
When to pick which

Pick Fargate when

  • You want to focus on the application and not provision, patch or scale servers.
  • Workloads are variable — you would rather pay per task-second than for idle instances.
  • You are starting with containers, or you need strong per-task isolation.

Pick the EC2 launch type when

  • You run large, steady, high-utilisation workloads that must be price-optimised.
  • You need GPUs, privileged containers, the DAEMON strategy, or bridge/host networking.
  • You need custom AMIs, specific instance types, or host-level access.
Sources
  1. Architect for AWS Fargate for Amazon ECS — https://docs.aws.amazon.com/AmazonECS/latest/developerguide/AWS_Fargate.html
  2. Amazon ECS launch types — https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html
  3. ECS task definitions for Fargate — https://docs.aws.amazon.com/AmazonECS/latest/developerguide/fargate-tasks-services.html
  4. ECS task definitions for GPU workloads — https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-gpu.html
  5. AWS Fargate pricing — https://aws.amazon.com/fargate/pricing/
  6. Amazon ECS pricing — https://aws.amazon.com/ecs/pricing/
Related instruments