允许外部用户启动/停止Google Compute Engine VM实例

时间:2018-03-23 09:10:51

标签: google-cloud-platform google-compute-engine gcloud google-cloud-iam

我有一个Google Cloud Compute Engine实例,我在其中创建了一个新用户(通过adduser),以允许开发人员在实例中工作。现在他有SSH访问权限并且可以在实例中登录,但是我希望他能够启动/停止实例,这样当他不工作时它就不会运行,以防止在空闲时进行计费。理想情况下,他可以安装gcloud并运行gcloud compute instances start/stop命令但不运行其他命令

我查看了IAM角色,但似乎没有Compute Instance User角色。是否可以授予外部用户这种能力?

1 个答案:

答案 0 :(得分:1)

是的,只要他们拥有任何类型的Google帐户。 Here's how to do it;事实上,您似乎想要create a custom IAM role并在有问题的实例上给他们instances.reset, instances.start, and instances.stop

Cloud Identity可能是正确的工具,如果他们不在贵公司,则可以授予他们访问权限;更多信息here

顺便说一下,adduser不是允许额外用户访问实例的正确方法; OS Login是工作的正确工具。 (还有另一个现已弃用的方法:adding their SSH key to the instance metadata)。