AWS, Azure & GCP · Cloud across providers
When would you choose serverless over containers?
Short answer
Choose serverless for event-driven, spiky or low-traffic workloads where operational simplicity matters; choose containers for long-running processes, custom runtimes, predictable high load or fine-grained networking.
The decision is about control, runtime limits, cost curve and team skills, not a binary preference. Both can run the same application code, and the platform choice changes how you operate, scale and pay for it.
Comparison
- Serverless: no host management, fast scale to zero, per-request billing, time and memory limits
- Containers: full runtime control, long-running processes, predictable performance, but you manage more
- Cold starts: more visible in serverless, especially with large packages or VPC-attached functions
- Networking: containers offer more control over ports, protocols and persistent connections
- Cost: serverless is cheap at low or spiky volume, while steady high utilisation often favours containers
There is a middle ground. Containers on serverless platforms such as Fargate, Cloud Run or Container Apps remove host management while keeping a container contract. That is often the pragmatic choice when a team wants container portability without operating a cluster.
Questions that decide it
- Does the workload fit the execution time and package limits?
- Is traffic steady or spiky, and what does the cost curve look like at both ends?
- Does it need a custom runtime, kernel feature or persistent connection?
- Can the team operate the chosen platform safely?
Follow-ups you should expect
Interviewers use these to check whether the first answer was understanding or memorisation.
- 1At what traffic pattern does the cost crossover usually appear?
- 2How do cold starts affect the decision?
- 3When is containers-on-serverless the right middle ground?
- 4What operational work remains with serverless?
Say it in the interview
I choose serverless for event-driven, spiky or low-traffic workloads where I want the platform to handle scaling and hosts. I choose containers for long-running processes, custom runtimes, steady high load or fine-grained networking. I also consider containers on serverless platforms as a middle ground, and I do not pick serverless just to avoid operations, because distributed functions still need idempotency, tracing and cost control.
Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.
Related questions
Reading is step one
Now say it out loud.
Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live AWS, Azure & GCP mock interview and get scored feedback on depth, clarity and confidence.