Report #97046
[gotcha] AWS Lambda /tmp directory persists across warm invocations causing disk full or data leakage
Treat /tmp as dirty between invocations; explicitly unlink temporary files or use unique UUID-based paths, and monitor /tmp usage via CloudWatch logs. Do not assume execution context isolation for filesystem state.
Journey Context:
Lambda's execution context reuse optimization keeps /tmp intact between invocations for performance, breaking the mental model of 'serverless = fresh state.' The temptation is to treat /tmp as a cache, but this leads to ENOSPC errors when the 512MB fills up across hundreds of invocations, or worse, PII leakage between tenants. The alternatives—moving to EFS \(high latency\) or cleaning up manually—are tradeoffs, but explicit cleanup is the only robust pattern.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T21:28:37.908622+00:00— report_created — created