2
我怎樣才能改變當前正在運行的項目到另一個項目使用CLI GCP帳戶命令除了使用gcloud初始化手動。如何更改項目中使用CLI命令GCP
$ gcloud項目列表將列出我的帳戶上運行的項目。我想使用cli命令將當前項目從列表中更改爲任何其他項目。
我怎樣才能改變當前正在運行的項目到另一個項目使用CLI GCP帳戶命令除了使用gcloud初始化手動。如何更改項目中使用CLI命令GCP
$ gcloud項目列表將列出我的帳戶上運行的項目。我想使用cli命令將當前項目從列表中更改爲任何其他項目。
您正在尋找:
$ gcloud配置集項目我的項目
您也可以設置環境變量$CLOUDSDK_CORE_PROJECT
。
我做喜歡的別名,以及可能需要多個命令,根據您的項目需求的東西,我喜歡的功能...
例
function switchGCPProject() {
gcloud config set project [Project Name]
// if you are using GKE use the following
gcloud config set container/cluster [Cluster Name]
// if you are using GCE use the following
gcloud config set compute/zone [Zone]
gcloud config set compute/region [region]
// if you are using GKE use the following
gcloud container clusters get-credentials [cluster name] --zone [Zone] --project [project name]
export GOOGLE_APPLICATION_CREDENTIALS=path-to-credentials.json
}
感謝..其工作。 –