Connecting Cloud SQL from App Engine with TCP.

84 views
Skip to first unread message

Janghwan Lee

unread,
Jun 22, 2018, 12:44:18 PM6/22/18
to Google App Engine

I'm trying to use Cloud SQL from the Scala application running in App Engine.
I used to use app.yaml configuration 
beta_settings:
  cloud_sql_instances:

I think this option doesn't seem to support TCP proxy (which is supported by the cloud_sql_proxy utility google provides).
However, my database connection library (mysql-async) does not support unix socket connection.
Why don't they add TCP proxy option in app.yaml config.
What is the best practice to connect Cloud SQL from app engine?

Jordan (Cloud Platform Support)

unread,
Jun 25, 2018, 4:29:48 PM6/25/18
to Google App Engine
In-bound socket connections are not supported in App Engine (some runtimes support outbound connections with limitations). Therefore, the correct way to connect to your SQL instance from App Engine is via a UNIX socket connection from your application code to the local SQL proxy built into App Engine. This can be done easily via a supported API in the runtime language you chose as shown in the documentation (example for Python).

- Note: Google Groups is reserved for general product discussions and is not for technical support. If you require further technical support for connecting your App Engine application to Cloud SQL, it is recommended to post your detailed questions to Stack Exchange using the supported Cloud tags.  

Janghwan Lee

unread,
Jun 26, 2018, 3:02:12 PM6/26/18
to google-a...@googlegroups.com
I can’t get the answer from stack exchange because there’s no way to do it as you mentioned. Then, let me change my question.
Why don’t you support TCP connection proxy for App Engine? Many modern SQL libraries do not support UNIX connection, and it prevents us to use Cloud SQL.

On Mon, Jun 25, 2018 at 1:30 PM 'Jordan (Cloud Platform Support)' via Google App Engine <google-a...@googlegroups.com> wrote:
In-bound socket connections are not supported in App Engine (some runtimes support outbound connections with limitations). Therefore, the correct way to connect to your SQL instance from App Engine is via a UNIX socket connection from your application code to the local SQL proxy built into App Engine. This can be done easily via a supported API in the runtime language you chose as shown in the documentation (example for Python).

- Note: Google Groups is reserved for general product discussions and is not for technical support. If you require further technical support for connecting your App Engine application to Cloud SQL, it is recommended to post your detailed questions to Stack Exchange using the supported Cloud tags.  

--
You received this message because you are subscribed to a topic in the Google Groups "Google App Engine" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-appengine/qY00qmXpPPo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/87acab90-b9ee-4c31-a006-562780df2dcb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jordan (Cloud Platform Support)

unread,
Jun 28, 2018, 7:46:26 PM6/28/18
to Google App Engine
For reference, this is an existing Feature Request in the Public Issue Tracker for this App Engine limitation. Since App Engine Standard runs on containers, its current architecture implementation was strictly designed around HTTP interfacing, and not sockets. There is also an open feature requests for App Engine sockets support, and there is an early access request form (for both Standard and Flex).  

If you are using App Engine Flexible, I was able to find this example working with TCP connection to Cloud SQL in .Net. All further communications about this request should continue in the open feature request

Jason Collins

unread,
Jun 30, 2018, 2:09:08 PM6/30/18
to Google App Engine
Hi Jay - it sounds like you're trying to connect to Cloud SQL _from_ App Engine Standard.

There are two ways to do this:

2. TCP connection. To do this, you must connect to a public IP Cloud SQL address from Google App Engine.
Reply all
Reply to author
Forward
0 new messages