AWS Lambda's /tmp Directory Isn't as Clean as You Think
Assuming every Lambda invocation runs in a fresh, isolated environment is a very reasonable guess. It’s also wrong.
Hi everyone 👋
A lot of developers write Lambda functions on the assumption that each invocation starts in a completely clean, isolated sandbox — new environment, empty disk, nothing left behind from whatever ran before. That assumption is exactly what “serverless” seems to promise. It isn’t quite what happens.
🔍 What’s actually happening: warm starts To keep invocations fast, Lambda reuses the same underlying execution environment (container) for consecutive invocations whenever it can — this is a warm start, as opposed to spinning up a brand-new one from scratch (a cold start). Reusing the container is exactly what makes warm invocations fast.