Back up and restore Postgres ΒΆ

Create a backup of a Postgres database that you can keep for up to two years, and restore it into a new database. Backups are stored in your team's disaster-recovery bucket and remain available after the source database is deleted.

Backups are separate from the point-in-time recovery window, which only covers the last 2 to 30 days and is deleted together with the database. To restore a database that still exists to a recent point in time, see Clone or restore Postgres.

Backups are currently managed in Nais Console only. You must be a member of the team.

Create a backup ΒΆ

  1. Open your team in Nais Console and select Postgres.
  2. Select the database in the correct environment, then the Backups tab.
  3. Select Create backup.
  4. Optionally, change Backup name. The default is <POSTGRES-NAME>-<YYYYMMDD>-<HHMM> in UTC.
  5. Optionally, change Retention (days): 1 to 730, counted from when the backup completes. The default is 30.
  6. Select Create backup.

The backup runs asynchronously. Its status changes from preparing to running to completed. The list updates automatically while backups are in progress. Once the backup is completed, Expires shows when it will be deleted.

If the status is failed, hover it to see the reason, and create a new backup when the problem is fixed.

Restore a backup ΒΆ

A restore creates a new database from a completed backup. It does not overwrite existing databases or move your workloads.

  1. Open your team in Nais Console and select Postgres.
  2. Find the backup, either in the Backups list on the team's Postgres page or on the Backups tab of the source database. Backups of deleted databases are only listed on the team's Postgres page.
  3. Select Restore on the backup. This opens Create Postgres with the Restore from backup tab and the backup selected.
  4. Enter a Database name for the new database.
  5. Optionally, adjust the resources. See what the restored database gets.
  6. Select Restore database.

The new database's page shows the progress. Wait until it shows Restore completed and the database is ready.

Only completed backups that have not expired can be restored, and only into the same team and environment.

To move workloads to the restored database, follow Move workloads to the clone with the new database's name.

Delete a backup ΒΆ

Backups are deleted automatically when they expire. To delete one earlier:

  1. Find the backup in a Backups list as described above.
  2. Select the trash icon, then Delete backup.

Deletion permanently removes the backup from the disaster-recovery bucket and continues asynchronously. A backup cannot be deleted while a restore from it is still in progress.