2
votes

I have an auto-scalable group of google compute engine vms which are configured to connect with second generation cloudsql database instance on the google cloud platform.

I tried to simplify the connection by using SQL proxy connection setup from vm boot up through startup-scripting so that I could avoid adding and removing instances' external ip addresses on instance creation or deletion. Following the instance's daemon.log everything seems to be ok regarding vm to cloudsql connection but on reaching the instance vm via external http it takes an unexpectedly long time to load the index.php and then prints on the screen

Error:sqlstate[hy000][2002] connection timed out.

Did you try cloudsql private ip? - night-gold
Actually no, I did not try to use private IP. I am having auto scaled gce vm instance group with the dynamic IP addresses - Benedict
That's why I speak of private IP, witht this you don't need to use the cloudsql proxy to connect or to autorize IP, all connexion with an account on % can connect using the IP directly from inside the network. - night-gold
In past I used the gcloud command: gcloud sql instances instance-name --authorized-networks instance-ip-address - Benedict
I have tried to use the same gcloud sql instances instance-name --authorized-networks instance-ip-address with instance startup-script it emmits error after diagnosing the instance daemon.log I found the error message stating (gcloud.sql.instances - Benedict