如何为 firebase 云功能设置 vpc 连接器?
How to setup vpc connector for firebase cloud functions?
GCP 之上的 Firebase Cloud Functions 运行,那么,他们支持使用 vpc connector 吗?
我想要实现的是限制转发代理服务器仅接受来自内部网络的请求,但由于 Cloud Functions 不支持静态 IP,唯一的方法是通过 vpc 连接器。
Cloud Functions for Firebase 实际上没有 运行 "on top of" GCP。 Firebase 只是添加了一些工具和 SDK,使 Cloud Functions 更易于某些开发人员使用。无论您是使用 Firebase 工具还是 gcloud 进行构建和部署,核心 Cloud Functions 产品都完全相同。
您应该仍然能够为使用 Firebase CLI 部署的函数配置 VPC 连接器。您将无法像使用 gcloud 那样在命令行上配置它。相反,您必须在部署该功能后在云控制台中配置连接器,完全按照您链接到的文档中的描述进行配置。
这似乎在最新的 firebase-tools v8.9.0 版本中得到处理。
Must be used in conjunction with firebase-functions v3.11.0 or higher
https://github.com/firebase/firebase-tools/releases/tag/v8.9.0
functions
.runWith({
vpcConnector: 'test-connector',
vpcConnectorEgressSettings: 'PRIVATE_RANGES_ONLY'
})
.auth.user()
.onCreate((user) => user);
由于 Firebase 只是 Google Cloud Functions 的包装器,因此只需绕过 Firebase CLI 并使用具有更多参数的那个。 (Google 云 CLI)
即
$ gcloud functions deploy <function_name> --trigger-http --runtime nodejs10 --vpc-connector projects/<your_project_name>/locations/<your-vpc-region>/connectors/<vpc_name> --service-account <your-role-name>
来源:
https://cloud.google.com/functions/docs/networking/connecting-vpc
GCP 之上的 Firebase Cloud Functions 运行,那么,他们支持使用 vpc connector 吗?
我想要实现的是限制转发代理服务器仅接受来自内部网络的请求,但由于 Cloud Functions 不支持静态 IP,唯一的方法是通过 vpc 连接器。
Cloud Functions for Firebase 实际上没有 运行 "on top of" GCP。 Firebase 只是添加了一些工具和 SDK,使 Cloud Functions 更易于某些开发人员使用。无论您是使用 Firebase 工具还是 gcloud 进行构建和部署,核心 Cloud Functions 产品都完全相同。
您应该仍然能够为使用 Firebase CLI 部署的函数配置 VPC 连接器。您将无法像使用 gcloud 那样在命令行上配置它。相反,您必须在部署该功能后在云控制台中配置连接器,完全按照您链接到的文档中的描述进行配置。
这似乎在最新的 firebase-tools v8.9.0 版本中得到处理。
Must be used in conjunction with firebase-functions v3.11.0 or higher
https://github.com/firebase/firebase-tools/releases/tag/v8.9.0
functions
.runWith({
vpcConnector: 'test-connector',
vpcConnectorEgressSettings: 'PRIVATE_RANGES_ONLY'
})
.auth.user()
.onCreate((user) => user);
由于 Firebase 只是 Google Cloud Functions 的包装器,因此只需绕过 Firebase CLI 并使用具有更多参数的那个。 (Google 云 CLI)
即
$ gcloud functions deploy <function_name> --trigger-http --runtime nodejs10 --vpc-connector projects/<your_project_name>/locations/<your-vpc-region>/connectors/<vpc_name> --service-account <your-role-name>
来源: https://cloud.google.com/functions/docs/networking/connecting-vpc