【发布时间】:2019-11-06 14:01:33
【问题描述】:
我想从其他 GCP 项目连接到 Cloud SQL。
Cloud SQL 是 ProjectSQL 中的位置,并且 VPC 网络位于 ProjectSQL 项目中,名称为 sql_vpc
还有另一个项目 ProjectDataflow,它有一个 vpc dataflow_vpc。我想使用 ProjectDataflow 项目中启动的 VM 从 ProjectSQL 连接到 cloudSQL
我尝试过的成功和失败的事情。
私人访问:
VPC 对等:
Enable Private IP access in Cloud with the vpc sql_vpc
Creating VPC peering between dataflow_vpc and sql_vpc
This solution does not work because you can not access the Peered Network.
https://cloud.google.com/sql/docs/mysql/private-ip
Status: FAILED
共享网络
As per doc I can create the CloudSQL in shared VPC network, that says I
have to create the CloudSQL in host project, and to access the Cloud
SQL from VM instance, it has be in the same network as of authorized
private ip network of Cloud SQL
Status: NOT TRIED but looks to be Negative
公共访问:
Create a Cloud NAT in ProjectDataflow with dataflow_vpc with manual IP
Use the Cloud NAT public ip to whitelist in CloudSQL instance
Now I can access the CloudSQL from project ProjectDataflow using CloudSQL Public IP
STATUS: Success
请分享您从另一个项目访问 Cloud SQL 的经验。 从另一个 gcp 项目连接云 SQL 是否有任何最佳实践?
【问题讨论】:
标签: google-cloud-platform google-cloud-sql google-cloud-networking