英文:
Why gcloud command fails on project settings
问题
你当前的项目已设置为:[myproject-1]。
错误:(gcloud.init) 失败的命令:[compute zones describe us-east1],退出代码为[1]
有人能帮忙解释为什么我会收到这个错误吗?我试图重新初始化 gcloud auth init
,当我设置项目编号时,我收到上述错误。我需要将项目区域更改为另一个区域吗?
谢谢,
Ashish
英文:
Your current project has been set to: [myproject-1].
```bash
ERROR: (gcloud.init) Failed command: [compute zones describe us-east1] with exit code [1]
Can someone help with why I am getting this error? I am trying to reinitialize gcloud auth init
and when I set the project number, I receive the above error. Do I need to change the project region to another region?
Thanks,
Ashish
答案1
得分: 1
错误消息表明在 gcloud 尝试定义 us-east1
时出现问题,该地区不是一个区域而是一个区域。正确的命令来定义该地区应该是:
gcloud compute regions describe us-east1
如果您想要设置默认区域,您可以将 us-east1-b
或 us-east1-c
作为示例。
您可以使用以下命令设置默认字段。
gcloud config set number/location[zone]
示例命令:
gcloud config set number/location us-east1-b
如果问题仍然存在,请检查您是否具有项目所需的适当角色和权限。
英文:
The error message indicates a problem when gcloud tries to define us-east1
, which is a region and not a zone. The correct command to define the region would be
gcloud compute regions describe us-east1
If you are trying to set a default zone, you may put us-east1-b
or us-east1-c
as an example.
You can set the default field with the following command.
gcloud config set number/location[zone]
example command:
gcloud config set number/location us-east1-b
If the issue persists, please check if you have the proper roles and permissions for the project.
答案2
得分: 0
@JohnHanley 当然,我会保持我的帖子具有标准输入和标准输出,我的帐户拥有所有者和编辑角色,以下是如何使用元数据更新区域的方法:
> gcloud compute project-info add-metadata \
> --metadata google-compute-default-region=us-west2,google-compute-default-zone=europe-west1-b
英文:
@JohnHanley Sure , I will keep my post with standard input and standard output, My Account had Owner & Editor roles, Here is how to update zone using metadata
> gcloud compute project-info add-metadata \
> --metadata google-compute-default-region=us-west2,google-compute-default-zone=europe-west1-b
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论