cloud sql access from compute enqine
Hi, maybe I'm missing something but it seems insanely difficult to connect to Cloud SQL postgres instance from compute engine.
I setup a simple PHP script attempting to connect but getting Error 500 response. The same script on my network is working perfectly. I put a firewall exception in Compute Engine to allow the connection, and Cloud SQL would not allow me to add Compute Engine's IP as its from a private network.
I cannot really run a LAMP stack as the data needs are very high. Is there any way to enable access? I know this should be possible as I was able to add the postgresql-client via SSH and connect to the instance from within GCP. But it seems the script fails somehow:
$this->conn = new PDO("pgsql:host=$dbhost;dbname=$dbname", $dbuser, $dbpassword);