How to change the project in GCP using CLI commands

前端 未结 16 1711
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-29 18:07

How can i change the current running project to another project in GCP (Google Cloud Platform) account using cli commands other than using

16条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-29 18:37

    I add aliases to the .bash_alaises to switch to a different project.

    alias switch_proj1="gcloud config set project ************"
    

    Here is a script to generate aliases :) for all projects listed. Please update the switch_proj to unique project aliases that you can remember.

    gcloud projects list | awk '{print "alias switch_proj=\"gcloud config set project " $1 "\""}'
    

提交回复
热议问题