0
votes

I'm trying to move my dynamic website and database from my own VM's to the Google cloud. For the DB, I'm using the Google Cloud SQL, and for the website I made a host under compute.

The problem is, I can't seem to connect to the DB from the VM using an internal IP address. Somehow my Cloud SQL DB only has an external IP address.

I also have phpMyAdmin running on a compute VM, this machine can also only connect to the external ip address (this works, but I'm guessing is not very secure)

What am I doing wrong? Must I use the app engine instead for my website? I've done the training exercise but, to be honest, I have no clue what I was doing.

1
Did you try the importing DB option? You can import the database to Google cloud SQL. - Bravin Balasubramaniam
Either your VM needs to have an external ipv4 address, or you need to use Cloud SQL proxy: cloud.google.com/sql/docs/compute-engine-access - Herman
i can import the db, that's no problem. i can also connect the vm to the db using the external ip but that sounds insecure. i get the feeling the sql cloud instance from google is not ment for internal use. - Lennart Giaccotto

1 Answers

0
votes

CloudSQL does not currently support private networks. You either need to connect via external IP or use CloudSQL proxy.

In order to increase security make sure to connect via SSL when using external IP.