Stop 12 · Containers on AWSTopics · 7/8

Choosing Between EC2, Containers & Lambda

Part of the AWS Roadmap

In short

Interviewers love asking 'Would you run this on a VM, containers or Lambda?' There's no single right answer, but there is a sensible way to think it through. Here it is.

Lambda suits short, event-driven tasks with no servers to manage, containers on ECS or EKS suit long-running services, and EC2 gives full control for special needs. The choice depends on workload shape, team skills and cost.

The blob character with a suitcase looks at a flat, a guest house and a small hotel.

Think of it like this

Flat, PG or hotel

Moving cities for years? Rent a flat and furnish it your way. Staying a few months? A PG room with meals sorted. Just a two-day interview trip? A hotel by the night. Same need, a roof, but different lengths and effort.

Watch it happen

A quick decision path

Need OS control?
Yes: VM
No: how it runs?
Always on
Containers
Short, on events
Serverless

1/4First question: do you need a custom OS, kernel modules, special software or licence rules tied to a machine?

The big ideas

What you need to know

VMs: most control

Any OS, any software, full access. You also own patching, scaling setup and monitoring.

Containers: portable middle

Same image everywhere, fast deploys, efficient use of servers. You still run an orchestrator or managed service.

Serverless: least ops

No servers, automatic scaling, pay per use. Limited by run time, cold starts and the provider's way of doing things.

Mix them

Real systems combine all three: containers for the API, functions for image processing, a VM for a legacy tool.

Save yourself the pain

Common mistakes

Oops

Picking the trendiest option and making the app fit it.

Do this instead

Start from the workload: how long it runs, how traffic looks, what the team knows. Then choose.

Oops

Ignoring team skills.

Do this instead

A team that knows VMs well may ship faster there than struggling with Kubernetes. Skills are a real constraint.

Your mission

Choose for five apps

~20 min

Quick check

A webhook gets 50 calls on a normal day and 20,000 during a sale, each call taking 200 ms. Best first choice?

Go deeper

  1. 1Pick the best fit for an image-resize job, a long-running API and a legacy app that needs a custom OS setup.
  2. 2Note the Lambda limits that push a workload towards containers.
  3. 3Explain your choice for one of your own projects in its README.

More topics at this stop

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.

Download
InsideEdge