Appearance
Heroku
How to back up Heroku managed PostgreSQL databases via SimpleBackups.
Heroku Postgres is a managed PostgreSQL service available as an add-on to Heroku applications. Connecting it to SimpleBackups lets you store independent backup copies in your own storage with customizable retention schedules. This guide walks you through copying your connection URI and setting up the backup.
Connecting your database
Step 1: Copy your connection string
- Log in to your Heroku console.
- Navigate to the Datastores list.
- Click on the database you want to back up.

- Click the Settings tab, then click View Credentials.

- Copy the URI.

Step 2: Create a database backup in SimpleBackups
- Navigate to Backups and click Create Backup, then select Database Backup.

- Choose Serverless as the backup server type.
- Select PostgreSQL as the database type.
- Click Paste connection string and fill in the complete connection string for your Heroku Postgres database, making sure the password is included.

- Click Validate Connection.
- Set a schedule and configure retention policies and storage.

- Review your configuration and save. SimpleBackups will start backing up your database according to your schedule.
Restoring a backup
To restore a backup, navigate to your backup page and open the Logs tab. Click the detail icon on the backup you want to restore from, then open the Restore tab. Generate a download link and copy it.



Run the following command to download and decompress your backup (replace the URL with your signed download link):
bash
wget -O - "<signed-download-url>" | gunzip -c > backup.pgsqlThen restore using pg_restore, replacing <your-database-uri> with your full database connection string:
bash
pg_restore -d "<your-database-uri>" ./backup.pgsql