Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Cloud Storage - switch projects

I recently started using Google Cloud Storage. Initially I created a dummy project while installing the Cloud SDK. Now I am working on another project. The gsutil is still pointing to my previous project. How do I make it point to my new project??

P.S. I know there is an option of using -p argument, but this does not work on all commands.

like image 542
user3571631 Avatar asked Feb 24 '17 18:02

user3571631


People also ask

How do I switch between Google Cloud projects?

Open it up, scroll down to the line default_project_id = , and change the project after the equals sign. Edit: I missed that you were using gsutil as part of the gcloud suite. My suggestion only applies if you've installed gsutil directly. Travis's suggestion is the right one if you have gcloud installed.

How do I select a project in GCP?

Go to the Dashboard page in the Google Cloud console. Click the Select from drop-down list at the top of the page. In the Select from window that appears, select your project.


2 Answers

To change the default project that gcloud (and gsutil) use in a gcloud installation, you should do this:

gcloud config set project desired-project-id-here

You can view your current settings with gcloud config list.

You can view all configurations available with gcloud config configurations list.

You can then switch to an alternate configuration with gcloud config configurations activate [NAME]

like image 134
Travis Hobrla Avatar answered Oct 06 '22 09:10

Travis Hobrla


I got this fixed by running gcloud init and following the commands to reinitialize the configuration.

like image 24
user3571631 Avatar answered Oct 06 '22 08:10

user3571631