简体   繁体   English

如何使用受限地址 Ip 触发 google cloud function?

[英]How to trigger google cloud function with restricted Ip address?

Basically, I would like to trigger my google cloud function without authentication and only allowed some IP public address to trigger it.基本上,我想在没有身份验证的情况下触发我的谷歌云 function,并且只允许一些 IP 公共地址触发它。

After many research I don't find any way to do that, so if you know something, I'm interested:D经过多次研究,我没有找到任何方法来做到这一点,所以如果你知道什么,我很感兴趣:D

Thank you in advance先感谢您

Following this official documentation , you can configure the.network settings of your Cloud Functions depending on your use case.按照此官方文档,您可以根据您的用例配置 Cloud Functions 的 .network 设置。 For starters, to be able to restrict IP addresses to trigger your function, you can set up ingress settings.对于初学者来说,为了能够限制 IP 地址触发你的 function,你可以设置入口设置。

Ingress settings restrict whether a function can be invoked by resources outside of your Google Cloud project or VPC Service Controls service perimeter. 入口设置限制 function 是否可以被 Google Cloud 项目或 VPC Service Controls 服务边界之外的资源调用。 You can specify one of the following ingress setting values:您可以指定以下入口设置值之一:

  • Allow all traffic : Default.允许所有流量:默认。 All inbound requests to the function are allowed, from both the inte.net and resources within the same project.允许来自 inte.net 和同一项目内的资源的所有入站请求 function。
  • Allow internal traffic only : Only traffic from Workflows and VPC.networks in the same project or VPC Service Controls perimeter is allowed.仅允许内部流量:仅允许来自同一项目或VPC Service Controls 边界中的 Workflows 和 VPC.networks 的流量。 All other requests are denied with a 403 error.所有其他请求都被拒绝并出现 403 错误。
  • Allow internal traffic and traffic from Cloud Load Balancing : Traffic from Workflows and VPC.networks in the same project or VPC Service Controls perimeter is allowed.允许内部流量和来自 Cloud Load Balancing 的流量:允许来自同一项目或 VPC Service Controls 边界中的 Workflows 和 VPC.networks 的流量。 Traffic from Cloud Load Balancing is allowed.允许来自 Cloud Load Balancing 的流量。

Sample gcloud command: gcloud命令示例:

gcloud functions deploy FUNCTION_NAME \
--trigger-http \
--ingress-settings INGRESS_SETTINGS \
FLAGS...

Additionally if you choose the Cloud Load Balancing option, you can follow this article, How to securely load balance cloud functions on GCP using Cloud Armor .此外,如果您选择云负载平衡选项,您可以按照本文 如何使用 Cloud Armor 在 GCP 上安全地负载平衡云功能

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何为 HTTP 触发器验证谷歌云 function? - How to authenticate google cloud function for HTTP trigger? 如何在 Firebase 云 function 中获取客户端 IP 地址? - How to get client IP address in a Firebase cloud function? 是否可以在谷歌云控制台或 firebase 控制台中更改项目 ip 地址 - Is it possible to change project ip address in google cloud console or firebase console Google Cloud Dataflow 可以在 Go 中没有外部 IP 地址的情况下运行吗? - Can Google Cloud Dataflow be run without an external IP address in Go? 如何在 Google Cloud Storage 中指定特定文件以触发 Google Cloud Function - How do I specify a specific file in Google Cloud Storage to trigger a Google Cloud Function 我位于亚洲的 Google Cloud 功能的美国 IP 地址 - US IP address to my Google Cloud functions located in Asia 如何找到Google Workflows使用的IP地址? - How to locate the IP address that Google Workflows uses? 如何通过 Next.js(带有 Typescript)应用程序调用经过身份验证的 HTTP 触发器 Google Cloud Function? - How Do I Call An Authenticated HTTP Trigger Google Cloud Function Via A Next.js (with Typescript) App? 如何将动态 IP 地址添加到 Google Cloud 中的“授权 javascript 来源”列表中,以便将 Google 登录集成到我的 web 应用程序中? - How can I add a dynamic IP address to the "Authorised javascript origins" list in Google Cloud so that I can integrate Google sign-in into my web app? 如何从 Java 中的 Cloud Function 触发 Cloud Dataflow 管道作业? - How to trigger Cloud Dataflow pipeline job from Cloud Function in Java?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM