cloud
resource_limit
ai_generated
true
OSError: [Errno 28] No space left on device in AWS Lambda /tmp
ID: cloud/aws-lambda-tmp-storage-512mb
88%Fix Rate
90%Confidence
3Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| any | active | — | — | — |
Root Cause
Lambda /tmp is limited to 512MB by default (expandable to 10GB since 2022). But /tmp persists across warm invocations! Previous invocation's temp files eat into the next invocation's quota.
genericWorkarounds
-
92% success Clean /tmp at the start of each invocation
import shutil, os; [os.remove(os.path.join('/tmp', f)) for f in os.listdir('/tmp')] -
95% success Configure ephemeral storage up to 10GB in Lambda config
aws lambda update-function-configuration --function-name my-func --ephemeral-storage '{"Size": 5120}' -
88% success Use S3 or EFS for large file processing instead of /tmp
Mount EFS filesystem or stream data to/from S3 instead of downloading to /tmp
Dead Ends
Common approaches that don't work:
-
Increase Lambda memory to get more /tmp space
92% fail
Lambda memory and /tmp storage are independent. More memory does NOT increase /tmp. You must configure ephemeral storage separately.
-
Write temp files and assume they're cleaned up between invocations
90% fail
/tmp is NOT cleaned between warm invocations. Files from previous invocations persist and accumulate.