Ephemeral filesystem

Temporary local disk that may be wiped whenever a function, container, or hosted instance is replaced.

why did my uploaded file disappear after deployfiles vanish when the container restartstemporary disk inside a functioncan I save files on serverlesslocal storage that gets wipedwhere do user uploads go if there is no diskephemral filesystemcontainer files are not permanent

See it

Live demo coming soon

What it is

An ephemeral filesystem is local disk whose contents are not promised to survive a restart, redeploy, reschedule, or replacement. A warm serverless instance may appear to keep a file for the next request, but another request can land on a different instance with an empty disk.

Reach for it as scratch space: unpack an archive, resize an image, buffer a download, then discard the result or copy it to durable storage. AWS Lambda gives you /tmp, 512 MB by default and configurable up to 10 GB. Heroku taught a generation of developers this lesson the hard way: dynos restart at least once a day, and whatever was written to disk goes with them.

Never treat local survival during testing as a durability guarantee. Files are not shared between replicas, and a platform can remove them without warning. Put uploads and generated assets in object storage, and put durable application state in a database or persistent volume.

Ask AI for it

Update this AWS Lambda function to use /tmp only as scratch space. Configure the AWS SAM EphemeralStorage Size property to 1024 MB, stream the input from Amazon S3, delete temporary files in a finally block, and persist the result with S3 PutObject before returning. Do not assume a later invocation sees anything left by an earlier one.

You might have meant

serverless computing functions as a serviceedge runtime vs node js runtimecontainer image containerobject storage storage bucketcold start