How to use Service Accounts with gsutil, for uploading to CS + BigQuery
Google Cloud Storage just released a new version (3.26) of gsutil that supports service accounts (as well as a number of other features and bug fixes). If you already have gsutil installed you can get this version by running:
gsutil update
In brief, you can configure a service account by running:
gsutil config -e
See gsutil help config
for more details about using the config command.
See gsutil help creds
for information about the different flavors of credentials (and different use cases) that gsutil
supports.
Mike Schwartz, Google Cloud Storage Team
To extend @Mike answer, you'll need to
- Download service account key file, and put it in e.g.
/etc/backup-account.json
gcloud auth activate-service-account --key-file /etc/backup-account.json
And now all calls use said service account.