google-compute-engine - 使用来自另一个 Google 项目的服务帐户创建 Google 计算实例
问题描述
我想知道是否可以将 my-project-a 中创建的服务帐户附加到my -project-b中的 Google Compute Engine 实例?
以下命令:
gcloud beta compute instances create my-instance \
--service-account=my-service-account@my-project-a.iam.gserviceaccount.com \
--scopes=https://www.googleapis.com/auth/cloud-platform \
--project=my-project-b
给我以下错误:
(gcloud.beta.compute.instances.create) Could not fetch resource:
- The user does not have access to service account 'my-service-account@my-project-a.iam.gserviceaccount.com'. User: 'me@mysite.com'. Ask a project owner to grant you the iam.serviceAccountUser role on the service account. me@mysite.com is my account and I'm the owner of the org.
不确定这是否相关,但查看 UI(在my-project-b中)没有选项可以从任何其他项目添加服务帐户。我希望能够添加帐户my-service-account@my-project-a.iam.gserviceaccount.com
解决方案
您可以按照以下步骤将服务帐户从 my-project-a 验证到 my-project-b 中的实例:
推荐阅读
- reactjs - 我可以在同一个 dotnet spa 应用程序上使用多个 useProxyToSpaDevelopmentServer 吗?
- javascript - 如何将 api 调用中的元素列表附加到无序列表?
- google-sheets - 根据其他值添加值,但 SUMIF 是完全正确的
- typescript - 开始在 tsconfig 中使用 'strict'
- python - Django:如何实时删除模型
- configuration - 检索或导出 VoIP 应用程序配置文件
- javascript - 这个 useReducer 反应代码有什么问题?
- highlight - 突出显示与其余代码不同的部分代码
- java - 我在java中正确实现了插入排序吗?
- django - Python django,在创建注册表单时如何让这个 .get 方法工作?