Amazon Web Services
Serverless — AWS Lambda
Run code in response to events without provisioning or managing any servers.
Lambda runs a function when an event arrives. There is no server to size, patch or keep running.
A motion-sensor light. It draws zero power in the dark and switches on instantly the moment someone walks by, for exactly as long as needed — you never pay to leave it burning all night.
Key Concepts
1
S3 object created -> resize the image
API Gateway request -> handle the HTTP call
SQS message -> process the job
EventBridge schedule -> nightly report
DynamoDB Stream -> react to a row change2
You choose memory; CPU follows it. 1,792 MB is roughly one full vCPU. So a CPU-bound function is often
cheaper at higher memory, because it finishes proportionally faster — a counter-intuitive point worth
knowing.
3
Billing is per millisecond of execution, with nothing charged while idle. That is the real difference
from a server sitting at 5% utilisation all night.
4
Cold starts are the limitation to be honest about.
cold new execution environment: download, init runtime,
run your init code -- tens to hundreds of ms
warm environment reused, handler only5
Keep the init light, reuse SDK clients across invocations, and use provisioned concurrency when a
latency-sensitive path cannot tolerate it.
6
Concurrency is the scaling and the blast radius.
account limit 1,000 concurrent executions by default
reserved guarantee capacity for a critical function AND
cap it so it cannot starve the others
provisioned pre-warmed environments, no cold start, charged7
Reserved concurrency as a cap is the under-appreciated use. Without it, one runaway function can consume
the whole account limit and throttle everything else.
8
The hard limits.
15 minutes maximum execution
10 GB memory, 10 GB ephemeral /tmp
6 MB synchronous payload, 256 KB asynchronous9
Functions are stateless. Anything that must persist goes to S3, DynamoDB or ElastiCache. The /tmp
directory survives only while the environment is reused, which makes it a cache and never a store.
/tmp
10
What the interviewer is probing.1. "What causes a cold start and how do you reduce it?" Probing: whether you can be specific.
Stalls: "The first call is slow." Moves up: a new execution environment must download the code
and initialise the runtime; keep init light, reuse clients across invocations, and use provisioned
concurrency for latency-sensitive paths.
11
2. "Would raising memory ever make a function cheaper?" Probing: the CPU relationship, which
is counter-intuitive. Stalls: "No, memory costs more." Moves up: yes for CPU-bound work — CPU
scales with memory, so it finishes proportionally faster and the millisecond bill can fall.
12
3. "What does reserved concurrency do?" Probing: both of its uses. Stalls: "It guarantees
capacity." Moves up: it guarantees capacity and caps it, so one runaway function cannot consume
the account limit and throttle everything else.
13
4. "What are the hard limits you design around?" Probing: the boundaries. Stalls: "There are
none." Moves up: 15 minutes, 10GB memory and /tmp, 6MB synchronous payload — so long work goes
asynchronous and large payloads go via S3.