Specify account for single gsutil call
I want to be able to perform simultaneous gsutil
calls against Google Cloud Storage, using different accounts.
For that purpose, I'd like to know if there is a way to specify a Google Cloud account for a single gsutil
call, i.e. something similar to gcloud
's --account
option:
> gcloud --account $account_1 $command_1
> gcloud --account $account_2 $command_2
Solution 1:
I am not sure if gsutil supports account name and credentials files as an argument but the closest solution I can come up with is activating an account, and if successfuly making a gsutil call -
gcloud auth activate-service-account --key-file=project1.json && gsutil ls
gcloud auth activate-service-account --key-file=project2.json && gsutil ls
You can also setup multiple accounts in a config file and switch between accounts - this link might help - https://stackoverflow.com/questions/14409499/how-can-i-use-gsutil-with-multiple-accounts
Solution 2:
There exists gcloud alpha storage
which has some of gsutil's functionality and supports the --account
flag.