AWS Fargate
Serverless compute engine for containers
Imagine you have a shipping container full of your application, and you need someone to run it. Normally, you'd rent a truck (EC2 instance), load the container on it, and drive it yourself. Fargate is like calling a delivery service where you hand them the container, tell them how much CPU and memory it needs, and they handle everything else. You don't manage trucks, don't worry about maintenance, don't even see the trucks. You just pay for the time your container is running. It's serverless containers: all the benefits of containerization without managing the underlying servers.
Fargate is a serverless compute engine for containers that works with both ECS (Elastic Container Service) and EKS (Elastic Kubernetes Service). Instead of provisioning EC2 instances to run containers, you define task definitions (ECS) or pod specs (EKS) specifying CPU, memory, and container images. Fargate provisions the exact compute resources needed and runs your containers in isolated microVMs.
Key Capabilities
Key configurations: task CPU/memory (must match specific combinations), networking mode (awsvpc: each task gets its own ENI), and IAM task roles.
Gotchas & Constraints
Gotcha #1: Fargate tasks take 30-60 seconds to start (slower than EC2-backed containers), so it's not ideal for bursty workloads requiring instant scale. Gotcha #2: Fargate costs more per vCPU-hour than EC2, so for steady-state workloads running 24/7, EC2 might be cheaper. Constraints: Limited to specific CPU/memory combinations, GPU support is available for AI inference workloads (announced late 2024), and tasks are ephemeral; there is no persistent storage except EFS mounts.
A microservices architecture runs 20 different services, each containerized. Previously, they ran ECS on EC2 instances, but managing cluster capacity was a nightmare: over-provisioning wasted money, under-provisioning caused outages. They migrate to Fargate, defining each service as an ECS task with specific CPU/memory requirements. Fargate automatically provisions compute for each task. When a service needs to scale (e.g., the payment service during checkout spikes), ECS launches more Fargate tasks without worrying about cluster capacity. They use Application Load Balancer for traffic distribution and Service Discovery for inter-service communication.
The Result
40% reduction in operational overhead, no more cluster management, and precise cost allocation per service.