"You don't have permission to enable Compute Engine" 使用 GCloud

"You don't have permission to enable Compute Engine" with GCloud

我为用户创建了一个新项目,并赋予他们 Compute Instance Admin 的角色。但是,当他们第一次加载项目时,他们收到错误消息“

You don't have permission to enable Compute Engine.

作为所有者,我需要访问项目的计算页面以对其进行初始化。此时,用户可以访问 Google 计算。

有没有办法自动为项目启用 Compute Engine?或者,是否有我可以添加用户以启用它的角色?

Is there a way to automate enabling Compute Engine for a project?

安装 Cloud SDK 后,

$ gcloud service-management enable --project foo compute-component.googleapis.com

应该可以解决问题。否则,您可以通过其他方法调用 Google Service Management


Or, is there a role I can add the user to enable it?

来自API docs

Authorization requires the following Google IAM permission on the specified resource service_name:

servicemanagement.services.bind

顺便说一句,我不知道哪些角色有那个权限。

启用API需要更高的责任。 compute.instanceAdmin.v1 该角色不允许用户启用 API。

如果您是所有者并启用了 GCE API,用户可能需要几分钟才能访问 GCE,因为一些资源需要像默认配置一样在项目上配置网络、防火墙和路由。

要在项目中启用 API,所需的最低角色是项目编辑者。