Report #73649
[gotcha] AWS Lambda disk space exhaustion or data leakage between executions
Always explicitly clean up /tmp writes at the start or end of invocation, or use /tmp only for ephemeral caching with strict size limits and TTL checks. Do not assume /tmp is fresh per invocation. For sensitive data, use /tmp only if encrypted or prefer memory-only storage.
Journey Context:
AWS Lambda reuses execution environments \(warm starts\) for performance. The /tmp directory \(512MB-10,240MB depending on config\) is writable and persists across invocations in the same environment. This is intentional for caching, but leads to two gotchas: \(1\) Disk exhaustion if temporary files accumulate across invocations without cleanup, eventually causing 'No space left on device' errors. \(2\) Security/data leakage where sensitive data written to /tmp in one invocation might be readable by a subsequent invocation from a different tenant if execution environments are recycled \(though AWS isolates tenants, bugs happen; more commonly, application logic errors where user A's file is read by user B in next invocation\). The pattern is to treat /tmp as a persistent cache with cleanup, not a fresh temp directory.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T06:13:01.932132+00:00— report_created — created