Why it matters

Lambda changes the cost structure of many workloads. A batch job that runs an hour a day pays for the hour, not for 24 hours of idle instance time. This can drop costs by 90+ percent for infrequent workloads.

Advertisement

The architecture

A Lambda function has code, a runtime (Python, Node, Java, etc.), memory allocation (also determines CPU), and a handler entry point. Invocation is either synchronous (get result back), async (fire and forget), or event-source-mapped (Lambda polls a stream).

Cold starts happen when Lambda starts a new instance. Warm invocations reuse existing instances. Cold start latency varies by runtime and package size.

Lambda execution modelFunction code + confighandler + memoryTriggerevent sourceExecution envcontainer per instanceCold start creates container; warm invocations reuse it until scale-down
Lambda function anatomy.
Advertisement

How it works end to end

Execution environment is a lightweight container. Each container handles one invocation at a time. Concurrent invocations spin up more containers. Concurrency limits per account and per function prevent runaway costs.

Provisioned concurrency keeps N containers warm to eliminate cold starts. Costs money per hour.

Layers let you share code across functions. Extensions add sidecars for observability or security.