问题
I am trying to connect Cloud SQL Server from Cloud Function. My Cloud SQL Server exists in asia-south1 region and that region doesn't have support for deploying Cloud Functions. So, I created and deployed Cloud Function in asia-east2 region and trying to connect to SQL Server using private IP as instructed at this link: https://cloud.google.com/vpc/docs/configure-serverless-vpc-access. All resources are in same VPC and facing Connection Timeout error.
I also observed that if both SQL Server and Cloud Function hosted in the same region and same VPC, then able to access the SQL server without any issues using serverless VPC access connector.
Is that cross-region access feature is supported? Or is there any other way to achieve this?
回答1:
At the moment cross-region access feature is not supported because the SQL Servers are behind Internal TCP/UDP Load Balancers:
Google Cloud Internal TCP/UDP Load Balancing is a regional load balancer that enables you to run and scale your services behind an internal load balancing IP address that is accessible only to your internal virtual machine (VM) instances.
However this might change with the implementation of the new L4 ILB features:
- ILB global access
- ILB as next-hop with multi-NIC support for third-party appliance integration that deliver greater availability, scale and ease of management.
Regarding you post about connecting from Cloud functions to Cloud SQL server (resources located on the same region) can you please tell me which SQL server image you used, what was the runtime of the function and what was the connection string. I was trying for the last days to reproduce without success.
来源:https://stackoverflow.com/questions/60396509/serverless-vpc-access-connectors-unable-to-connect-to-cross-region-network-res