2

I'm looking for a way to expose my google cloud sql server (running mysql), to my api servers.

I might add/remove them in the future and adding them mysql access is an additional step in configuration with already complex setup (for my app).

And I went trough this tutorial, where I can manually add api server(s) : https://cloud.google.com/sql/docs/access-control

However I liked this part which should solve my problem :

Use a proxy service so that your application appears to come from only one IP address. Add this address to the authorized networks that can connect to the instance.

Is it possible to create this proxy within the google cloud? So I can proxy my api instances trough the proxy and add the proxy to the access list.

Question update:

From the answer I got looks like there is nothing provided by google to make this work. Which kind of sucks (no offense google team, there are so many other awesome features).

Anyone from google support have comment? If not I'll accept the answer within 24hrs

LWC
  • 115
  • 7
Remember_me
  • 133
  • 4

2 Answers2

1

Yes, you could perfectly create a Compute Engine instance to act as the proxy.

The only caution you should take is to use a static IP for that instance (instead of a temporary IP), so that if the instance gets rebooted, the IP wouldn't change from the one you authorized in your Cloud SQL instance.

Mario
  • 126
  • 1
0

Update: You can use the Google Cloud SQL proxy (GitHub) for this purpose.


Alternatively, you can also use a standard MySQL proxy running on a Google Compute Engine VM, e.g., one of these solutions:

  • MaxScale - open-source, database-centric proxy.
  • Mixer - a MySQL proxy powered by Go which aims to supply a simple solution for MySQL sharding.
  • MySQL Proxy - A simple program that sits between your client and MySQL server(s) that can monitor, analyze or transform their communication.
  • ProxySQL - High performance proxy for MySQL.
Misha Brukman
  • 768
  • 8
  • 22