36
votes

Can I write to the container's local filesystem from a Google Cloud Function? AWS Lambda allows writing to /tmp:

Q: What if I need scratch space on disk for my AWS Lambda function?
Each Lambda function receives 500MB of non-persistent disk space in its own /tmp directory.

Is there something equivalent in GCF?

1

1 Answers

50
votes

Yes, /tmp is an in-memory mount. From https://cloud.google.com/functions/docs/concepts/exec#file_system:

File system

The only writeable part of the filesystem is the /tmp directory, which you can use to store temporary files in a function instance. This is a local disk mount point known as a "tmpfs" volume in which data written to the volume is stored in memory. Note that it will consume memory resources provisioned for the function.