Creating a European Heroku PostgreSQL Database

written on Friday, February 07, 2014 by

If you want to create a Heroku PostgreSQL database via the web frontend, you might notice that they don't ask you where you want to create the database. It simply defaults to the US region.

Screenshot of the Heroku configuration options.

Now usually when you create a database directly via the web frontend, the reason is that you just want the database, but don't want a Heroku app because you're hosting your web application on a different server (e.g. Amazon EC2). The problem here is that it is currently not possible to use PostgreSQL without a Heroku app – the app is simply created implicitly by the database creation tool:

The automatically created Heroku app.

The solution to have a Heroku Postgres database in Europe is to create a free "dummy app" that only serves as the container for your database. It won't cost you anything as long as you don't start a web or worker dyno. You can either create it via the web interface:

Creating a new app on Heroku.

...or via command line:

Creating a new app via command line.

That's it, you now have a European "container" for your database. If you add the Heroku Postgres plugin to this app, it's also going to be provisioned in Europe.

This entry was tagged heroku and postgresql