AWS Lambda Internals
AWS Lambda execution through event routing, microVM isolation, and warm reuse.
AWS Lambda looks simple from the outside: upload code, define a handler, and wait for events. Underneath, it is a control plane for provisioning short lived execution environments, routing invocations to them, and tearing them down without exposing raw servers to the customer.
The control plane starts working as soon as you deploy a function. Lambda stores the function package or container image metadata, tracks configuration such as memory, timeout, IAM role, environment variables, and networking settings, and prepares this information so workers can fetch it quickly when needed. The actual code does not run until an event arrives, but the service has already done a lot of bookkeeping.
When an invocation comes in, Lambda has to find or create an execution environment. AWS has publicly described using Firecracker microVMs for this isolation layer. A microVM gives stronger separation than running unrelated customer functions as ordinary processes, while staying lighter than a traditional virtual machine. Inside that sandbox, Lambda provides a runtime environment for Node.js, Python, Java, .NET, or a custom runtime.
If a suitable warm environment already exists for the same function version, Lambda can reuse it. That avoids redoing the expensive parts of startup. If not, a cold start happens. The platform allocates capacity on a host, boots the microVM, mounts or downloads the function code, starts the language runtime, runs initialisation code outside the handler, and only then delivers the event. Cold starts are why package size, runtime choice, VPC configuration, and heavy global initialisers all matter to latency.
The execution model has two visible phases. First comes init, where global code runs and SDK clients, database pools, or caches may be created. Then comes invoke, where the handler processes a specific event. Lambda may reuse the same environment for later invokes, so memory contents, open connections, and files in temporary storage can survive between requests. That is useful for performance, but it means functions must not assume a perfectly clean process every time.
Synchronous and asynchronous invocation paths behave differently. In a synchronous path, such as an API request, the caller waits while Lambda routes the event to a worker and returns the result. In an asynchronous path, the front end accepts the event, stores it durably in an internal queue, and later dispatches it to workers. That decoupling allows retries and smoothing of bursts, but it also means duplicate delivery is possible. Well designed Lambda handlers are therefore idempotent.
Scaling is mostly automatic, but not infinite. Lambda can create many environments in parallel, yet concurrency quotas, downstream bottlenecks, and per function reserved limits still shape behaviour. If traffic spikes faster than new environments can start, latency rises. If your function opens too many database connections, the database fails before Lambda does. Serverless does not remove capacity planning. It moves the focus from server counts to concurrency and downstream protection.
The major tradeoff is between convenience and control. Lambda removes host management, patching, and most idle cost, but in exchange you accept runtime limits, ephemeral local state, noisy cold start behaviour, and a platform managed networking model. It works best for event driven workloads that can tolerate retries, short execution windows, and stateless scaling. Behind the scenes, the impressive part is not that code runs on demand. It is that AWS can create isolated workers fast enough, route events into them safely, and reuse them just enough to make the economics work.