Google Cloud 函数和服务帐户

sea*_*ain 5 youtube-api service-accounts google-cloud-platform google-cloud-functions

我想使用 Google Cloud Functions 访问 Youtube Content Owner API。为此,GCF 使用的服务帐户必须有权访问该 API。

当我创建 Google Cloud Function 时,它会自动分配一个服务帐户。在本例中为“App Engine 默认服务帐户”。我对此有几个问题。

  1. Google Cloud Function 是否始终使用“App Engine 默认服务帐户”作为服务帐户?
  2. 在编辑云函数时,我看不到任何更改 Google 云函数服务帐户的方法。Cloud Function 一旦设置好,服务账号就不能更改了,对吧?
  3. 如果默认服务帐户可以访问 Youtube Content Owner API,那么 Google Cloud Functions 也会拥有它吗?

A.Q*_*eue 5

  1. 是的,Cloud Functions 使用 App Engine 默认服务帐户,如此处所述

  2. 事实上还没有这样的选择。如果您有兴趣,可以为此打开一个公共功能请求。

  3. 确实,Cloud Function 会继承默认服务帐号的所有访问权限。

或者,要使用除 App Engine 默认服务帐户之外的 Cloud Functions 凭据,您可以: