Skip to main content

ECS with EC2/Fargate

Elastic Container Service.
It can target EC2 or Fargate.

ECS on EC2

  • We get the EC2 VMs
  • Good to share VMs or with other workloads
  • Has a sidecar to orchestrate.
  • More control over infra/VMs.
  • More work
  • Pay by EC2 VMs used
  • Scales by EC2 Auto Scaling Groups
  • Better for long-running containers
  • Needs VM infra management, updates, security, networking, ASGs etc.

ECS on Fargate

  • Serverless, unaware of underlying infra.
  • Pay by usage container resources usage
  • Auto scaling
  • Less control but simpler management
  • AWS handles the underlying infrastructure
  • More cold starts, less predictability, higher cost by resource usage, limited storage/gpu/resource options
danger

Both do not share unused resources cpu/memory between concurrent runs and require fixed resource allocation.