Hello,
I'm currently using Cloud Run for my application, and I need to connect it to a persistent storage solution. The purpose is to store user data for future sessions. While considering different options, I found that Google Cloud Storage Fuse for Cloud Run does not meet my requirements. Additionally, I attempted to use GCP Filestore by mounting it as a network file system onto a Cloud Run service. Although it works, Filestore is quite expensive, and its lack of dynamic storage options is a drawback. Even if I only utilize 100MBs, I have to pay for the whole 1TB (minimum configuration storage).
Is there an alternative method in Google Cloud Platform (GCP) similar to AWS Elastic File System (EFS)? I'm looking for a solution that charges based on the storage actually used and can be configured for use with Cloud Run applications. Additionally, is there a way to connect EFS with GCP Cloud Run?
Thank you for your assistance.
Hi @himanshukukreja,
Welcome to the Google Cloud Community!
Cloud Run is a managed compute platform that automatically scales your stateless containers. It does not have any built-in storage.
For persistent storage, you should take a look at Connecting to Google Cloud Services. There are numerous storage or databases for you to choose. Among the choices, the 3 great options for persistent storage are:
You should also take a look at these Stackoverflow posts that talks about using persistent storage for Cloud run:
Currently, there is no direct way to connect AWS Elastic File System (EFS) to GCP Cloud Run, but there could be a workaround with Storage Transfer Between EFS and GCP Filestore.
Let me know if it helped, thanks!
Hi,
For persistent storage, you can also connect Cloud Run to Google Cloud Datastore (Firestore in Datastore Mode).
See this Stackoverflow response on how to do that.
Hi,
I'm a product manager on Cloud Run working on improving our volumes support. May I ask: in what way does Cloud Storage FUSE not meet your requirements?
Hi @knet while mounting a GCS bucket using FUSE my cloud run service never deploys the next revision and hangs while bringing up the next revision.
No logs, no errors, so very hard to know why it doesn't work.
Also if I am better off opening a separate issue LMK and I will do so.
I would like something that works like: https://fly.io/docs/volumes/overview/
Not an NFS server that needs VPC endpoints etc and not a hacky s3fs type of thing
Hello Roopak, we're working on improving our logging here. Were you able to resolve the issue? We will be launching a create/edit UI in Cloud Console soon, so that may be an easier way to get things configured correctly.
Hi Knet
Another issue with gcs bucket with fuse in cloud run is that it does not support changing file directory permissions . Ex i tried running chmod +x on a file but it did not change the permission . Althogh it supports read and right , it is not supporting exceution permission on the file.
Can you please have a check on this as well, because this issue only persist s with GCS volume with Cloud run , when we try attaching the fuse directlty to a compute engine or gke via Csi driver i am able to change the file permission.
We recently launched support for mount options which lets you set the UID and GID on your files, does that help?
FWIW, GC Storage doesn't work for my use-case either. The fuse driver relies on locally caching files to/from the GCS bucket. My project is working with files typically 100gb or more which means my cloud run job would need enough local storage to cache the transfers to/from GCS. My workflow is that users upload files directly to a GCS bucket using signed-urls then there is a job to process these files and move the resulting processed file to a different GCS bucket to be consumed by another application.
That makes sense, Jeff. We're looking at ways to make this use case work on Cloud Run. How big are you biggest files?
gcsfuse doesn't work for my use case either. I'm using it with Cloud Run to download large videos, which can be up to 10GB. gcsfuse consumes a lot of RAM because Cloud Run uses an in-memory disk.
Alternatively, from GCSFuse version 2.9.1 onwards, writes can be configured with streaming writes feature ( which doesnt involve staging the file locally ) with the help of --enable-streaming-writes flag.
But unfortunately, there are no volume mounting options in the Cloud Run console interface. And adding this option to YAML results in an error: Unsupported or unrecognized flag for Cloud Storage volume: enable-streaming-writes (field: spec.execution_template.spec.task_spec.volumes[0]).