Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does gsutil support creating boto files with service account info?

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
like image 642
Christopher Schmidt Avatar asked May 01 '16 12:05

Christopher Schmidt


People also ask

What protocol does gsutil use?

gsutil performs all operations, including uploads and downloads, using HTTPS and transport-layer security (TLS).

Can we use boto3 in GCP?

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.


1 Answers

gcloud stores credentials in a file under ~/.config/gcloud (rather than .boto), and then passes them to gsutil when your use gsutil.

like image 103
Mike Schwartz Avatar answered Sep 21 '22 21:09

Mike Schwartz