AlgoViz

AWS Lambda

medium 25 min

AWS Lambda runs your function when an event arrives and stops charging when it ends.

When it comes up

The moments this idea belongs in a design interview, and the moments it does not.

Signals

When to bring it up

You hearSayBecause
Resize each uploaded photoS3 event to a functionShort, independent, spiky
Ten requests a dayA functionNothing idles
20,000 steady requests per secondContainers, maybe a function at the edgesAlways busy, so compare cost
Encode a two-hour filmA container task or split stepsOver the run time
Fifty milliseconds at p99.9Provisioned concurrency or containersCold starts sit in the tail

Options

Explain your choices

Orders arrive in bursts and each needs a slow payment call. How do you run it?

BreaksAPI Gateway to a function that pays
How
The customer waits for the whole call.
Limit
A slow provider multiplies concurrency, throttles everyone, and retries can charge twice.
Choose when
Low traffic and a fast provider.
WorksAsynchronous invocation
How
Return at once, let Lambda's queue hold the event.
Limit
Little control over the queue, only two retries on error.
Choose when
Occasional work that may be lost to a destination.
StrongSQS with maximum concurrency
How
Queue the order, cap the mapping at what the provider accepts, pass an idempotency key, report partial failures, use a dead-letter queue.
Limit
The result comes later, so the client must poll or be told.
Choose when
Bursts in front of a limited dependency.