I frequently use Google Cloud Storage with at least two accounts: [email protected] and [email protected]. I used gsutil config
to create .boto
files for both accounts, which I've renamed to personal.boto
and work.boto
.
It is tiring to have to remember to type cp personal.boto ~/.boto
whenever I need to switch between these accounts. Is there a better way?
If you want to switch the account used by the gcloud CLI on a per-invocation basis, override the active account using the --account flag.
"gcloud" can create and manage Google Cloud resources while "gsutil" cannot do so. "gsutil" can manipulate buckets, bucket's objects and bucket ACLs on GCS(Google Cloud Storage) while "gcloud" cannot do so.
The Google Cloud SDK now includes the gcloud
tool, which allows you to login and easily switch between accounts.
$ gcloud auth list
Credentialed accounts:
- [email protected] (active)
To set the active account, run
$ gcloud config set account <account>
To login to another account, simply run $ gcloud auth login
and use another Google account.
Easiest way to do this is as follows:
$ BOTO_CONFIG=/path/to/personal.boto gsutil cp #...
For more detailed variations on this theme see this thread.
For this, use following command to switch to the account you want.
gcloud auth login
This will take you to the Google account switch page which can be used to switch to the relevant user.
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