Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connecting a Google Cloud App Engine app to its Cloud SQL Instance-allowing database access

I have a Google Cloud project with an app and a Cloud SQL Instance. SQL requests from the app time out. Private IP connectivity is enabled. If I explicitly add the app instances' IPs to the SQL Instance's public authorized networks, it works. This is obviously a bad solution since these IPs change on every deployment. How do I permanently grant access to the app?

like image 595
Boris K Avatar asked Jul 07 '26 14:07

Boris K


1 Answers

Private IP's are only accessible by other services on the same Virtual Private Cloud (VPC). App Engine apps don't currently have access to VPC networks.

Edit: App Engine has recently released Serverless VPC Access, meaning that the can now be configured to connect via Private IP.

App Engine Standard does provide a unix domain socket to interface with Cloud SQL instances. Just tell your app to use the socket at /cloudsql/<INSTANCE_CONNECTION_NAME>; (with your instance's connection name), and it should be able to connect. If you are using a cross product or cross regional setup, there are more instructions here.

like image 50
kurtisvg Avatar answered Jul 09 '26 02:07

kurtisvg