How to handle multiple Storage accounts using gsutil?

459 views
Skip to first unread message

Micky Hulse

unread,
Dec 24, 2012, 3:17:46 PM12/24/12
to gs-dis...@googlegroups.com
Hello,

I have a personal and a work Google Cloud Storage account.

The only way I've been able to use gsutil on either account is to run
"gsutil config -b" and run through the setup.

Could someone point me towards documentation and/or post the steps I
would take to setup gsutil so I can work on two different accounts
without having to run through the config each time I want to switch
from one account to the other?

Many thanks in advance!

Cheers,
Micky

Nathan Herring (Google Cloud Storage Team)

unread,
Dec 24, 2012, 6:37:05 PM12/24/12
to gs-dis...@googlegroups.com
The environment variable BOTO_CONFIG controls which configuration file is loaded by Boto (which is a library that gsutil uses). When I want a separate account, I use something along the lines of:

alias gsutil-other-account=BOTO_CONFIG=$HOME/.boto-other-account\ gsutil

This is in Linux, but should work with Mac OS X as well. A small Windows .bat wrapper to do the same seems likely to do the trick, though I have not tried it.

Cheers,
Nathan
Google Cloud Storage Team



--



Micky Hulse

unread,
Dec 25, 2012, 3:38:30 PM12/25/12
to gs-dis...@googlegroups.com
Hi Nathan! Thanks so much for the help, I really appreciate it. Sorry
for my late reply.

On Mon, Dec 24, 2012 at 3:37 PM, Nathan Herring (Google Cloud Storage
Team) <gs-...@google.com> wrote:
> The environment variable BOTO_CONFIG controls which configuration file is
> loaded by Boto (which is a library that gsutil uses). When I want a separate
> account, I use something along the lines of:
> alias gsutil-other-account=BOTO_CONFIG=$HOME/.boto-other-account\ gsutil
> This is in Linux, but should work with Mac OS X as well. A small Windows
> .bat wrapper to do the same seems likely to do the trick, though I have not
> tried it.

Awesome! That looks like it will do the trick.

Also, just in case it helps anyone else down the road, when Googling
for "BOTO_CONFIG alias" I found this thread:

<https://groups.google.com/d/topic/gs-discussion/UMjqPKUNg6k/discussion>

... with similar suggestions.

Thanks again Nathan, it's much appreciated! :)

Have an excellent holiday.

Cheers,
Micky

Micky Hulse

unread,
Dec 25, 2012, 4:20:19 PM12/25/12
to gs-dis...@googlegroups.com
On Tue, Dec 25, 2012 at 12:38 PM, Micky Hulse <rgm...@gmail.com> wrote:
> Awesome! That looks like it will do the trick.

Cool, it did work perfectly.

I added the below line to my .bash_profile:

alias gsutil-hulse=BOTO_CONFIG=$HOME/.boto-hulse\ gsutil

Now I can run (for example):

gsutil-hulse getcors gs://fonts.personal-site.com/

... and:

gsutil getcors gs://fonts.work-site.com/

Awesome! :)

Thanks again!

P.S. I'm really digging Google Cloud Storage! You Google guys and gals
are doing some amazing stuff. Keep up the excellent work!

Cheers,
Micky

Micky Hulse

unread,
Dec 25, 2012, 4:45:10 PM12/25/12
to gs-dis...@googlegroups.com
Not sure if it will be useful to anyone, but I've added a "bonus"
section, with the alias info from this thread, to my Gist found here:

"Setting up Google Cloud Storage with CORS for Web Fonts.md"
<https://gist.github.com/4362104>

Thanks!
Micky
Reply all
Reply to author
Forward
0 new messages