我想从另一个 GCP 项目连接到 Cloud SQL。
Cloud SQL 是 ProjectSQL 中的位置,并且 ProjectSQL 项目中有一个 VPC 网络,名称为 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 的最佳实践?