Clone or restore Postgres ΒΆ
Clone a Postgres database from its backups, either from the latest available point or from a specific time. The clone is a new, writable database in the same team and environment. It does not change the source database or move your workloads.
Clone the database ΒΆ
Clone from the latest available point, about 10 minutes ago:
nais postgres clone <SOURCE-POSTGRES-NAME> <NEW-POSTGRES-NAME> --team <TEAM> --environment <ENVIRONMENT>To restore to a specific time instead, add --at:
nais postgres clone <SOURCE-POSTGRES-NAME> <NEW-POSTGRES-NAME> \
--team <TEAM> \
--environment <ENVIRONMENT> \
--at "2026-11-16 12:00"Times without an offset use your computer's local time zone. Use RFC3339 with Z or an explicit offset to specify an absolute time, for example 2026-11-16T12:00:00Z.
Review the configuration and confirm. To override the source's resource or high-availability settings, see the clone flags.
Check progress with:
nais postgres get <NEW-POSTGRES-NAME> --team <TEAM> --environment <ENVIRONMENT>Wait until Clone status is Completed and Status is Ready.
- Open your team in Nais Console and select Postgres.
- Select Create Postgres, then the Clone existing database tab.
- Select the environment and source database, and enter a name for the new database.
- Leave Specify time closed to use the latest available point, about 10 minutes ago. To restore to a specific time, open it and enter a time in your browser's local time zone, within the available recovery window.
- Optionally, open Customize resources to change CPU, memory, disk size or high availability. Keep the disk at least as large as the source's.
- Select Clone database. Follow the clone status on the new database's page and wait until cloning completes and the database is ready.
If the source has no available recovery window, wait for its backups before trying again. If the default clone point is too early for a newly created source, wait or specify a time within its recovery window.
Do not connect workloads to a failed clone. See Postgres cloning for inherited settings, time limits and completion status.
Inspect the cloned data by connecting as a personal user with the new database's name. This does not affect workload traffic.
Move workloads to the clone ΒΆ
Pause writes from the workloads you want to move.
Change
uses.postgres[].namein each workload's manifest to the new database's name:app.yamlspec: uses: postgres: - name: <NEW-POSTGRES-NAME>Keep any existing
roleandenvPrefixsettings. See Use Postgres in a workload.Deploy the changed workloads and verify that they connect to the clone and use the expected data.
Resume writes when verification is complete.
Do not delete the source database until cloning has completed, you have verified the data and no workloads still use it.