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
}
感谢..其工作。 –