AWS Lambda provides a temporary file system at /tmp for each execution environment. However, the contents of /tmp can persist across multiple
invocations of the same Lambda function instance during "warm starts." When temporary files are not cleaned up, they remain available to subsequent
invocations of the same function instance.
What is the potential impact?
This can lead to serious security and reliability issues: sensitive data from one invocation might leak to unrelated subsequent invocations, disk
space can be exhausted causing function failures, and stale data from previous runs can cause unexpected behavior and hard-to-debug issues.
Exceptions
- Writing to /tmp is recommended for caching data used by future lambda invocations.