【问题标题】:Why is there no IAM role specific to calling a GCP function?为什么没有特定于调用 GCP 函数的 IAM 角色?
【发布时间】:2021-06-17 13:38:58
【问题描述】:

如果我看https://cloud.google.com/functions/docs/reference/iam/roles#standard-roles 我看到了:

  • roles/cloudfunctions.admin
  • roles/cloudfunctions.developer
  • roles/cloudfunctions.viewer
  • roles/cloudfunctions.invoker

后者只包含一个权限,cloudfunctions.functions.invoke

我们正在使用 Google Cloud Workflows 来调用我们的云功能,但它目前因错误而失败:

"error": {
 "code": 403,
 "message": "Permission 'cloudfunctions.functions.call' denied on resource 'projects/redacted/locations/europe-west2/functions/funcname' (or resource may not exist).",
 "status": "PERMISSION_DENIED"
 }

令我惊讶的是,有一个角色/cloudfunctions.invoker 角色,它不是包含cloudfunctions.functions.call 的角色/cloudfunctions.caller。 roles/cloudfunctions.developer 包含该权限,但也包含许多其他内容。为什么没有这样的角色?

是的,我知道我可以创建一个自定义角色,如果我不必这样做就好了。

【问题讨论】:

    标签: google-cloud-functions


    【解决方案1】:

    据我了解Cloud Functions IAM Permissions

    cloudfunctions.functions.call => Call the callFunction API. cloudfunctions.functions.invoke => Invoke an HTTP function via its public URL.

    您提到“我们正在使用 Google Cloud Workflows 来调用我们的云功能”...不确定,但您可能正在使用这种方法 - projects.locations.functions.call。该页面上写着:“用于测试目的,因为允许非常有限的流量。”

    我不知道您的上下文和要求的所有详细信息,但您可以使用其 URL 调用云功能吗?

    【讨论】:

    【解决方案2】:

    额外信息

    您不能增加 CALL 配额。如果您在生产中错误地使用此 API 调用您的函数,通常会出现配额不足的情况。请注意,此 API 用于通过 Cloud Console 或 gcloud 函数调用 CLI 进行测试,它无法处理大量流量。

    https://cloud.google.com/functions/quotas#rate_limits

    【讨论】:

      猜你喜欢
      • 2021-11-07
      • 2018-09-09
      • 2021-12-22
      • 1970-01-01
      • 2021-03-02
      • 1970-01-01
      • 2020-10-28
      • 2021-09-28
      • 1970-01-01
      相关资源
      最近更新 更多