大网数据广告活动
服务器运维问答

Only allow connection to GCP Compute Engine VM originating from Cloud Run service

· 52CE 我爱测

I have a DB server running as a Compute Engine VM, and an API running on Cloud Run. Both are part of the same project. I want the DB VM to only be accessible from the Cloud Run code. At first I thought this should just work becau…

问题原文

原帖链接 · jminardi · CC BY-SA 4.0

I have a DB server running as a Compute Engine VM, and an API running on Cloud Run. Both are part of the same project. I want the DB VM to only be accessible from the Cloud Run code.

At first I thought this should just work because the firewall has a "default-allow-internal" rule that should apply to every machine in the project. However I was still getting connection failures.

Then I tried adding a new ingress rule that targeted the service account and allowed connections from the service account. This also didn't work.

I modified the rule to allow connections from my personal IP just to confirm the DB VM was working and my firewall rules worked, and everything worked as expected.

Finally I looked into filtering by "source tag" but the option was not selectable and I couldn't seem to be able to add source tags to the Cloud Run instance.

Is it possible for me to achieve my goal of restricting access to the DB VM to only allow incoming connections from the Cloud Run machine?

已采纳解答

原帖链接 · tsplus · CC BY-SA 4.0

You can configure Serverless VPC Acces to connect Cloud Run with Compute Engine VM, updated Sep 2020. https://cloud.google.com/vpc/docs/configure-serverless-vpc-access

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-03-04)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。