Report #62787
[gotcha] AWS Lambda /tmp directory content persists across warm invocations causing data leakage or disk full errors
Explicitly delete sensitive files at the end of handler or use /tmp only for caching with strict size management; assume the environment is reused but don't rely on it.
Journey Context:
Developers often assume Lambda is stateless and /tmp is clean per invocation. Actually, Lambda freezes the execution environment and thaws it for subsequent invocations, preserving /tmp contents. This leads to PII leakage between tenants if files aren't cleaned, or 'No space left on device' errors when /tmp fills up over time. The fix isn't to avoid /tmp—it's useful for caching ML models or dependencies—but to treat it like a temp directory that must be cleaned or managed with size quotas. Alternative approaches like using /dev/shm or EFS have different latency/cost tradeoffs.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T11:52:15.783711+00:00— report_created — created