Chapter 24: AWS Fargate
AWS Fargate
If you’ve been following along, we already talked about containers (the lightweight, portable tiffin boxes), ECS (AWS’s simple orchestrator), and EKS (the full Kubernetes version).
Today we’re focusing on Fargate — the serverless compute engine that lets you run those containers without ever touching, patching, or scaling EC2 instances.
Think of Fargate as the “Uber for containers”:
- You tell it: “I need this Docker container to run right now.”
- It instantly provides a clean, isolated environment (CPU + memory + networking).
- You pay only for the seconds it’s actually running.
- When the task finishes or scales to zero → it disappears.
- You never see, never manage, never pay rent for the underlying “car” (EC2 server).
Let me teach this properly, like we’re sitting together with a notebook — slow, detailed, real analogies, Hyderabad examples, 2026 reality, pricing, how it works with ECS & EKS, pros/cons, and a simple hands-on feel.
1. What Exactly is AWS Fargate? (Official + Human Explanation – 2026)
AWS Fargate is a serverless compute engine for containers that works with Amazon ECS and Amazon EKS.
It removes the need to provision, configure, or scale clusters of virtual machines (EC2 instances) to run containers.
- You define your container (Docker image + CPU/memory needs).
- You tell ECS/EKS to run it as a task (ECS) or pod (EKS).
- Fargate launches an isolated execution environment just for that container.
- When done → environment is terminated → zero cost until next run.
Official short line (still accurate in 2026): “Fargate is serverless compute for containers. You no longer have to provision, configure, or scale clusters of virtual machines to run containers.”
In Hyderabad terms: Imagine you want to cook biryani for a small family dinner.
- EC2 style → rent a full kitchen + stove + buy gas cylinder + maintain it 24/7.
- Fargate style → use Swiggy Genie or Dunzo: order “cook 1 kg biryani now”, pay only for the cooking time + ingredients used, delivery boy (Fargate) brings everything, cooks in a temporary setup, leaves when done. No kitchen ownership, no cleaning, no idle gas bill.
2. How Fargate Works (Step-by-Step – 2026 View)
- You build & push Docker image → to Amazon ECR (or Docker Hub).
- You create a Task Definition (ECS) or Pod spec (EKS)
- Image: your-app:latest
- CPU: 0.5 vCPU
- Memory: 1 GB
- Port: 3000
- Environment variables, secrets, logging (CloudWatch)
- You launch via ECS/EKS
- ECS Service → desired count = 2
- EKS Deployment → replicas = 3
- Fargate launches execution environment
- Isolated kernel + filesystem
- Exactly the CPU/memory you asked for
- VPC networking (private/public IP)
- IAM role for permissions
- Your container runs → does its job (API server, worker, batch job).
- Task/pod finishes or scales to zero → Fargate tears down environment → ₹0 cost.
3. Fargate with ECS vs Fargate with EKS (2026 Comparison)
| Aspect | Fargate with ECS | Fargate with EKS |
|---|---|---|
| Orchestrator | ECS (AWS native – simpler) | Kubernetes (industry standard – more powerful) |
| YAML/JSON used | Task Definition (JSON) | Deployment/Service YAML + Helm |
| Learning curve | Easier for AWS beginners | Steeper (need kubectl knowledge) |
| Ecosystem | Deep AWS integration | Full K8s ecosystem + portability |
| Control plane cost | Free | ~₹6,000/month per EKS cluster |
| Best for | Most startups, simple–medium microservices | Complex apps, teams already using Kubernetes |
2026 reality in Hyderabad: 80%+ of new container projects start with ECS + Fargate. Once teams grow to 20–30 engineers or need Helm/Istio/ArgoCD → they switch to EKS + Fargate.
4. Real Hyderabad Example: Serverless Microservices on Fargate
Your food delivery startup in Gachibowli (mini-Zomato clone):
- 5 microservices: orders, payments, restaurants, riders, notifications.
- Each in Docker image → pushed to ECR.
ECS + Fargate setup:
- ECS Cluster → Fargate
- Task Definitions:
- orders-service: 0.5 vCPU, 1 GB, port 3000
- payments-service: 0.25 vCPU, 0.5 GB
- Services:
- orders-service: desired count 2 → auto-scale on CPU > 60% (min 1, max 20)
- Behind ALB → /orders endpoint
- During lunch rush → traffic ×8 → Fargate spins up 12 more tasks in ~30–60 seconds.
- 3 AM → scales to 1 task per service → cost near zero.
- No EC2 instances → no patching, no capacity alarms, no “why is this node unhealthy?” tickets.
Monthly bill example (moderate traffic):
- ~100,000 task-hours/month
- Average 0.5 vCPU + 1 GB → ~₹4,000–9,000 (vs ₹15,000–25,000 on EC2 cluster)
5. Fargate Pricing in 2026 (ap-south-1 Mumbai – Realistic)
- No upfront cost, no cluster fee (unlike EKS)
- Billed per second for:
- vCPU used × $0.04048 / vCPU-hour (~₹3.4 / vCPU-hour)
- Memory used × $0.004445 / GB-hour (~₹0.37 / GB-hour)
- Minimum billing: 1 minute per task launch
Example calculation:
- Task: 0.5 vCPU + 1 GB RAM, runs 24 hours/day
- Cost/day: (0.5 × ₹3.4) + (1 × ₹0.37) ≈ ₹2.07/day
- Cost/month: ~₹62/task
Realistic startup bill: 10 tasks running average 8 hours/day → ₹2,000–6,000/month — scales to zero at night.
6. Quick Hands-On Mental Picture (Free Tier Friendly)
- Build simple Docker image (nginx “Hello from Hyderabad Fargate”)
- Push to ECR
- ECS console → Create cluster → Fargate
- Create Task Definition → 0.25 vCPU, 0.5 GB, your image
- Create Service → 1 task, add ALB
- Get ALB DNS → browser → see page
Cost? Usually ₹0–150 for testing (Fargate has generous free tier usage).
Summary Table – Fargate Cheat Sheet (2026)
| Question | Answer (Beginner-Friendly) |
|---|---|
| What is Fargate? | Serverless compute for containers — no EC2 to manage |
| Works with? | ECS (simpler) or EKS (Kubernetes) |
| Pay for? | vCPU + memory per second — idle = ₹0 |
| Best for? | Variable traffic, small–medium teams, no-ops preference |
| Vs ECS on EC2? | No patching/scaling nodes, higher per-hour cost but saves ops |
| First project idea? | Dockerize API → run on ECS Fargate + ALB |
Fargate is the “containers without infrastructure headaches” option — the #1 choice for most Hyderabad startups and growing teams in 2026 who want containers but hate managing servers.
Got it? Want next:
- Step-by-step: Deploy app to ECS + Fargate?
- Fargate vs ECS on EC2 cost deep dive?
- How Fargate works with EKS (pods on Fargate)?
Tell me — next class is ready! 🚀⚡
