HACKER Q&A
📣 arthurcolle

Is it possible to use your own Postgres instance (homelab) with Heroku?


I have looked at Heroku Data Links, but it seems like it only allows Heroku Postgres<-->Heroku Postgres, and apparently I can specify a DATABASE_URL that is located where I want, but I would like to have a VPN of some kind. Is this possible?

Alternatively, I could set up a VPC in AWS with an EC2 instance that can talk to my homelab db instance, and then just write an HTTP interface when I need the Heroku app to get data from my homelab postgres instance, but this seems a little convoluted.


  👤 craigkerstiens Accepted Answer ✓
You can absolutely use a Postgres not on Heroku with your Heroku app. The DATABASE_URL is the key part, there are customers on Heroku that use RDS or we've seen a few start to use Crunchy Bridge as well.

As for VPC peering, that is going to be less likely. You'd have to at least be using Heroku's private spaces and even then I'm not sure it's a turnkey integration. You essentially would need a static/public connection for Heroku to be able to connect.