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.
“Fresh environment” is carrying a lot of weight in that sentence.
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.