Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invoking gsutil or gcloud from a Google cloud function?

I have a Google Firebase app with a Cloud Functions back-end. I'm using the node.js 10 runtime which is Ubuntu 18.04. Users can upload files to Google Cloud Storage, and that triggers a GCF function.

What I'd like that function to do is copy that file to Google Cloud Filestore (that's File with an L), Google's new NFS-mountable file server. They say the usual way to do that is from the command line with gsutil rsync or gcloud compute scp.

My question is: are either or both of those commands available on GCF nodes? Or is there another way? (It would be awesome if I could just mount the Filestore share on the GCF instance, but I'm guessing that's nontrivial.)

like image 674
GaryO Avatar asked Jun 13 '26 08:06

GaryO


1 Answers

Using NFS based storage is not a good idea in this environment. NFS works by providing a mountable file system, something that will not work in Cloud Functions environment as the file system is read only with the exception of /tmp folder.

You should consider using cloud native storage systems like GCS for which the Application Default Credentials are already setup. See the list of supported services here.

like image 167
Kunal Deo Avatar answered Jun 15 '26 23:06

Kunal Deo