articles / fargate-avantages-inconvenients
Fargate on AWS: pros, cons and a decision grid
Mounir Guizani · 29 November 2026 · 3 min read
With ECS (or EKS), you have to choose where containers run: on EC2 instances you manage, or on Fargate, AWS's serverless mode for containers. The choice directly affects cost, operations and performance. Here is a pragmatic decision grid.
Fargate in one sentence
You declare the CPU and memory of each task, and AWS provides the capacity. No servers to manage: no AMIs, no patching, no cluster sizing, no half-empty instances.
The advantages
- Zero servers to administer. No more OS updates or cluster capacity management.
- Per-second billing, for the CPU and memory actually reserved per task, with a one-minute minimum. Ideal for batch jobs: the task runs twenty minutes, you pay for twenty minutes.
- Strong isolation: each task gets its own execution environment, with no neighbours on the same machine.
- Simple scaling: you increase the number of tasks without wondering whether the instances have room left.
- Fargate Spot for interruptible workloads, with a discount of up to 70%.
- Graviton (ARM) available, cheaper at equivalent performance for compatible images.
The drawbacks
- A higher unit price than a well-packed EC2 instance. For a steady 24/7 load, reserved EC2 instances or Savings Plans are often cheaper.
- No GPUs, and no privileged containers.
- Capped sizes: at most 16 vCPU and 120 GB of memory per task.
- Slower start-up: the image is downloaded every time a task launches, with no local cache. A Spring Boot image of several hundred MB shows it. Lean images (and SOCI lazy loading) narrow the gap.
- Less control over the machine: no host access, no DaemonSets on EKS, limited ephemeral storage (20 GB by default, up to 200 GB).
The decision grid
| Situation | My choice |
|---|---|
| One-off batch (Spring Batch triggered by EventBridge or Step Functions) | Fargate |
| API with variable traffic, small team | Fargate |
| Steady, heavy 24/7 load, cost optimisation | EC2 (reserved or Savings Plans) |
| Need for GPUs, privileged containers, host agents | EC2 |
| Interruptible, restartable workloads | Fargate Spot |
| Very large volume of short, identical tasks | measure it: EC2 may be cheaper |
You can also mix them: ECS lets you define several capacity providers and spread tasks across Fargate, Fargate Spot and EC2.
My settings for Spring Boot on Fargate
- Size the container memory, and let the JVM adapt with
-XX:MaxRAMPercentage=75. - Shrink the image: minimal JRE or GraalVM native image, to start faster.
- Account for start-up time in the health check grace period.
- Measure before optimising: CPU and memory actually used (CloudWatch Container Insights), then adjust task sizes. A task oversized by half is a doubled bill.
In short
Fargate trades a little unit price for a lot of operational time. For a product team, it is almost always the right starting point. You move to EC2 when the numbers, not intuition, show the load is steady enough to justify it.