Cloud Technology Community Question

Should I use AWS Lambda or Fargate for a spiky, event-driven web API?

Posted on 2025-09-08 • In Cloud Technology • By Christopher Reed

I'm designing a new API that will handle image processing. The traffic is very inconsistent—sometimes 1,000 requests a minute, then nothing for hours. I’m torn between the simplicity of Lambda and the control of Fargate. Which one is more cost-effective and easier to maintain for this specific type of spiky workload?

3 Answers 12,152 Views

All answers to this question 3 Answers

Cynthia Higgins Answered on 2025-09-10
Answered

For your specific case of "nothing for hours," Lambda is almost certainly the better choice. With Lambda, you pay exactly zero when the API isn't being called. Fargate, while "serverless" in terms of management, still requires you to have at least one task running to handle requests, meaning you pay for idle time. However, be mindful of "cold starts" in Lambda, especially if your image processing libraries are large. If your users can't afford a 2-3 second delay on that first request after a quiet period, you might need Provisioned Concurrency, which adds to the cost.

Matthew Foster Answered on 2025-09-11
Answered

What is the average execution time for your image processing? Remember that Lambda has a 15-minute timeout. If some of your larger images take longer than that to process, wouldn't Fargate be the safer architectural choice for long-running tasks?

Christopher Reed Commented on 2025-09-13
Commented

Matthew, most of our processing finishes in under 30 seconds. I hadn't considered the 15-minute limit, but it shouldn't be an issue for us. The bigger concern for us is the memory limit; some high-res images might need more than the 10GB that Lambda provides. We'll have to benchmark that first.

Rebecca Wood Answered on 2025-09-14
Answered

Start with Lambda. It's much faster to deploy and requires almost zero infrastructure code compared to setting up ECS clusters and task definitions. You can always migrate to Fargate later if you hit limits.

Cynthia Higgins Commented on 2025-09-16
Commented

Agreed with Rebecca. The "Developer Experience" on Lambda is just so much smoother for getting a MVP out the door. Plus, the integration with S3 triggers for image uploads is native and very easy to set up.

Write a Comment

Your email address will not be published. Required fields are marked (*)

Join the LearnersEra Community

Ask questions, share knowledge and learn from professionals across technology, project management and certification topics.

Change Country and Nearest City

Select your country and nearest city to see courses available in your region.