0
votes

This is probably a really simple question, but I can't seem to find an answer online.

I'm using a Google Cloud Function to generate a CSV file and store the file in a Google Storage bucket. I've got the code working on my local machine using a json service account.

I'm wanting to push this code to a cloud function, however, I can't use the json service account file in the cloud environment - so how do I authenticate to my storage account in the cloud function?

1

1 Answers

4
votes

You don't need the json service account file in the cloud environment.

If the GCS bucket and GCF are in the same project, you can just directly access it.

Otherwise, add your GCF default service account(Note: it's App Engine default service account ) to your GCS project's IAM and grant relative GSC permission.