I used to break every long job into small Lambda steps because I thought Fargate meant paying around the clock. It doesn't. An EventBridge Scheduler rule starts an ECS task on Fargate, the container runs for as long as the job takes, and you pay per second for that run only.
Use it when
- A job runs longer than Lambda's 15 minutes (nightly imports, reports, migrations, batch AI).
- A job needs more memory, disk or tooling than a Lambda comfortably has.
Don't use it when
- The job can be broken into small steps that each finish well inside 15 minutes. Lambda is simpler.
- The service must answer HTTP 24/7. That's a different (always-on) Fargate design.
Pricing
Per second of vCPU and memory while the task runs (one-minute minimum). Nothing between runs. Fargate Spot is cheaper if the job can be interrupted.
In my words: what hurts
- I assumed Fargate meant paying 24/7. A scheduled task doesn't.
Gotchas, with fixes
Gotcha: Fargate Spot tasks can be stopped with two minutes' notice.
Fix: Use Spot only for jobs that checkpoint or can safely restart.
Provisioning
Official Pulumi package · Official Terraform provider
ECS task definition + EventBridge Scheduler schedule, all in @pulumi/aws.
Instead, consider
- AWS Lambda Anything under 15 minutes.
Where it fits
- A job that runs for hours: Pick 01.
Runs only while the job runs, billed per second. Spot if it can restart.
Sources
Last reviewed by Nicolas Dao