Unable to connect App Engine Standard version to Cloud SQL Private IP.

269 views
Skip to first unread message

Rahul

unread,
Jun 24, 2019, 12:39:35 PM6/24/19
to Google Cloud SQL discuss
Hello,

I have created one instance of Cloud SQL Private IP. I have deployed one service(Java Service) on App Engine Standard Version to connect Cloud SQL Private IP with the help of Serverless VPC connector. All services reside in the same region.
But I am not able to connect to private IP Cloud SQL instance from AppEngine and It's throwing me an error as below.

Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.


CloudSQL.JPG


Emerson Moraes

unread,
Jun 24, 2019, 1:09:35 PM6/24/19
to Google Cloud SQL discuss
Hi,

Why do you are using private IP to connect? Have you tried to connect using INSTANCE_CONNECTION_NAME, that is the most common way to connect with Cloud SQL from App Engine? (https://cloud.google.com/sql/docs/mysql/connect-app-engine?hl=en-US)

If you are using Spring Boot, you can connect with Cloud SQL using instance name through the Spring Cloud GCP:

Att.,

Emerson Leite de Moraes
Message has been deleted

Rahul

unread,
Jun 25, 2019, 12:21:19 AM6/25/19
to Google Cloud SQL discuss
Thanks for your reply.

My Cloud SQL instance is running on Private IP only. Yes, I tried to connect using INSTANCE_CONNECTION_NAME, but it's failed to connect.

Sam (Google Cloud Support)

unread,
Jun 25, 2019, 8:42:01 AM6/25/19
to google-cloud...@googlegroups.com
Hi Rahul, you might want to opt for App Engine Flex instead as presently App Engine Standard doesn't support Private IP connection for reasons that pertain to a "sandboxed execution environment". As stated in our official documentation [1]: "you cannot use private IP to connect from standard environment."

In the standard environment the underlying compute, storage or network resources are not surfaced to the user as these are managed by GCP for a wide variety of customers, so this sandbox restricts what your application can do. For example, your application cannot write to disk or use non-whitelisted binary libraries. To allow access to other GCP resources your application typically accesses services like Cloud SQL via the built-in google.appengine APIs [2]. 

That being said, there are other execution environments that are more flexible. Read more about the differences and limitations between each execution environments here [3].

Kurtis Van Gent

unread,
Jun 25, 2019, 11:18:09 AM6/25/19
to Google Cloud SQL discuss
The Serverless VPC Connector is Beta, and I believe it works with App Engine Standard. More info on how it works here

Rohini Sundararajan

unread,
Feb 6, 2020, 1:42:15 PM2/6/20
to Google Cloud SQL discuss
Hi Rahul -  I am facing the same issue of connecting to Appengine cloud SQL instance via private ip.  Did this sort our for you. Can you please post the solution

Rahul

unread,
Feb 15, 2020, 12:58:25 AM2/15/20
to Google Cloud SQL discuss
Hi Rohini - May I know your AppEngine type (Flex or Standard) please?

We were not able to connect to Cloud SQL through Standard version so we thought to move Flex version and it's working well without VPC serverless connector. 
Reply all
Reply to author
Forward
0 new messages