将GCP连接器与无服务器框架一起使用 [英] Using GCP connector with serverless framework
问题描述
如果我需要指定连接器,如何使用无服务器框架部署Google Cloud功能,请参见
How do I deploy a Google Cloud function with Serverless framework if I need to specify a connector see https://cloud.google.com/functions/docs/connecting-vpc
我尝试将这些行添加到serverless.yml:
I've tried adding these lines to serverless.yml:
vpc_access_connector:
name: rojects/PROJECT_ID/locations/REGION/connectors/CONNECTOR_NAME
我也尝试过:
vpc_connector: rojects/PROJECT_ID/locations/REGION/connectors/CONNECTOR_NAME
因此未添加连接器.
To deploy a function I use serverless deploy
command https://serverless.com/framework/docs/providers/google/guide/intro/
推荐答案
关于如何创建和部署函数,您还没有说太多.您发布的链接提到可以在部署功能后编辑"VPC连接器"字段.因此,这应该是一种方法.部署该功能,然后编辑其设置以指定要使用的VPC连接器.
You have not said much about how you create and deploy the function. The link you posted mentions it is possible to edit the VPC Connector field after a function is deployed. So that should be one way. Deploy the function and then edit its settings to specify the VPC Connector to use.
更新
更可配置的解决方案可能是使用Deployment Manager模板.您可以使用此处可用的一种观点.但是它没有内置的VPC连接器配置,因此您将需要更新该模板以包括VPC连接器配置.
A more configurable solution might be to use a deployment manager template. You can use the one available here as a starting point. But it does not have VPC connector configuration built-in so you will need to update that template to include VPC connector configuration.
这篇关于将GCP连接器与无服务器框架一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!