I connect to a Google Cloud MySql db from my laptop, however my IP address not only changes at home, but also when I travel. I have to specify the allowed public ip address in Google Cloud, but every time I reconnect I have to log in & update google cloud with my new IP address. What is the best solution to not have to do that?
Asked
Active
Viewed 155 times
0
-
1Not connecting to the DB from your laptop, of course. A VPN, if you really can't avoid it (but you really can avoid it most of the time). – Michael Hampton Jul 03 '21 at 13:20
-
Use the Google Cloud SQL Auth Proxy. Very easy to run on your laptop/desktop. Unless you are using SSL when you connect via IP address, your authentication credentials are sent across the Internet in the clear. Since you mention travel, I recommend that you set up a VPN as well. – John Hanley Jul 03 '21 at 18:43
2 Answers
1
To add to what Michael said, if you absolutely must connect from your laptop (again, this by itself sounds like a big part of the issue to start with), you can look into
- using Cloud SQL proxy [1]
- securing your connection to the DB with a certificate [2]
[1] https://cloud.google.com/sql/docs/mysql/sql-proxy
[2] https://cloud.google.com/sql/docs/mysql/authorize-ssl

jabbson
- 720
- 2
- 9
0
Since you connect to the Cloud SQL instance via internet I assume the instance has a public IP. If so, you can use the gcloud sql connect
command.
Ref. https://cloud.google.com/sdk/gcloud/reference/sql/connect