How to configure multiple gcloud projects

走远了吗. 提交于 2021-02-11 05:08:33

问题


On my work laptop, i have gcloud configured with our prod projects. when i do gcloud config configurations list, I get only one row in result, which is ACTIVE and it's my work-project.

Now for some personal testing, I have created a separate project which is associated with my personal email id. How would i configure/connect this project with my gcloud cli?

I have tried

  • gcloud auth application-default login which opened the browser, i signed in using personal email id. The webpage showed me OK and the console never changed.

  • I have also tried gcloud auth login <personal_email_id>@gmail.com and got the same result.

So how can i connect my personal google projects to the same gcloud which is connected to my work-prod projects. Is it even possible?


回答1:


You are mixing 2 things:

  • Configuration set up in your Gcloud sdk
  • The project list that you have access

You can have several Gcloud config profile for easily switching from 1 configuration to another one. Use gcloud init to start the config. You could override the current config or define a new one. Then, you could perform gcloud config configurations activate <config Name> to switch between your configurations

For listing the projects of which your current user have access, use the command gcloud projects list

Here you can also find a more detailed tutorial about how to configure Google Cloud SDK for multiple projects that may be helpful to you.



来源:https://stackoverflow.com/questions/57983373/how-to-configure-multiple-gcloud-projects

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!