Skip to content

How to generate a Database dump from Heroku Postgresql

Joel Meador edited this page Jun 8, 2026 · 1 revision

How can I import Heroku Postgres Databases into my development environment?

1. Generate db backup (will show the id of the dump file)

$ heroku pg:backups:capture --app [app-name]

e.g.

$ heroku pg:backups:capture --app stge-ahc-ohana-api

2. List all the backups generated (will display all ids, dates and sizes of previous backups)

$ heroku pg:backups --app stge-ahc-ohana-api

3. Get the URL (use the id)

$ heroku pg:backups:url b12 --app [app-name]

https://xfrtu.s3.amazonaws.com/cdd49244-.......

4. Download the backup file

$ wget "https://xfrtu.s3.amazonaws.com/cdd49244...."

or

$ curl -o staging.dump "https://xfrtu.s3.amazonaw...."

5. Enjoy your dump file!

** Documentation: ** https://devcenter.heroku.com/articles/heroku-postgres-backups#creating-a-backup

** Heroku CLI tool: ** https://github.com/heroku/cli

Home

TODO: can we recreate the tag system here roughly with sections about certain subjects?

Clone this wiki locally