According to several examples, gsutil config can be used to create GCS-compatible .boto files from OAuth2 credentials for service accounts.
For example, https://cloud.google.com/storage/docs/xml-api/gspythonlibrary suggests under service account credentials that you should use gsutil config -e
to configure a .boto file; however, when running that command, I get:
CommandException: OAuth2 is the preferred authentication mechanism
with the Cloud SDK. Run "gcloud auth login" to configure authentication,
unless you want to authenticate with an HMAC access key and secret,
in which case run "gsutil config -a".
Following instructions, I do try to use gcloud auth activate-service-account:
$ gcloud auth activate-service-account --key-file=/Users/crschmidt/mirandum-local/cloud-storage-service.json
Activated service account credentials for: [[email protected]]
But this does not create a .boto file.
I can configure an interoperable HMAC project-id/secret under interoperability mode and use that, but since OAuth2 credentials are preferred, and service account credentials seem the right way to go, I'm not sure how to proceed. How can I write a .boto file for a service account?
crschmidt-macbookair:~ crschmidt$ gsutil --version
gsutil version: 4.19
gsutil performs all operations, including uploads and downloads, using HTTPS and transport-layer security (TLS).
Yes, please refer to the following docs: https://cloud.google.com/storage/docs/gsutil_install#sdk-install. https://cloud.google.com/compute/docs/tutorials/python-guide. https://cloud.google.com/storage/docs/boto-gsutil.
gcloud stores credentials in a file under ~/.config/gcloud (rather than .boto), and then passes them to gsutil when your use gsutil.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With