简体   繁体   中英

Google Cloud postgres – connecting from Heroku

I was using Postgres addon on Heroku and was connecting to the database using DATABASE_URL env var.

I now need to switch to Google Cloud Platform Postgres. I've created an instance and successfully added my local connection to the Authorised.networks . Yet it seems that Heroku does not provide a static IP for its apps.

My question is then – is it possible to connect my Heroku app to a Postgres database from the Google Cloud Platform? If yes – what's the best way to do it?

You will want to run the Cloud SQL Proxy alongside your application. This will allow your Heroku App to connect to Cloud SQL without the need to worry about changing and adding IPs to your Authorized Networks .

This thread might be useful for your use-case. Node and Cloud SQL with Heroku

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM