How automated backups and point-in-time restore work on Amazon RDS for PostgreSQL, how to restore to a timestamp with the CLI, and how to cut traffic over to the restored instance.

Amazon RDS backs up a PostgreSQL instance in two layers: a daily snapshot and transaction logs shipped to S3 every five minutes. Together they let you rebuild the database at any second inside the retention window, which is the feature you want the morning after a migration drops the wrong column.
A point-in-time restore never touches the running database. It creates a new instance with a new endpoint, missing some of the original's settings, and getting traffic onto it is up to you. This guide covers the retention settings, the restore itself and the cutover.
The RDS backup documentation lists the retention limits and explains how the backup window is chosen.
Retention is set per instance, seven days is a common default, and the latest restorable time usually trails the present by about five minutes, the interval at which logs are uploaded.
Longer retention costs backup storage beyond the free allowance, which equals the size of your provisioned database storage in the region. Pick a window that covers how long a silent data bug could go unnoticed, not only how long a crash takes to spot.
Pick a time immediately before the damage. If a deploy ran a bad migration at 09:12 UTC, restore to 09:11. The command below creates orders-restore in the same subnet group and security group as the original, which is what you usually forget.
Use --use-latest-restorable-time instead of --restore-time when the goal is recovering from a lost instance rather than undoing a change. The point-in-time restore guide lists the settings you can override during the restore.
Restores take time proportional to the data and the amount of log to replay. Plan for tens of minutes on a small database and hours on a large one, and test it before you need it.
The new instance is built from storage, not from the original's configuration. Check these before sending traffic:
From here, a full cutover points the application at orders-restore and retires the old instance once you are sure. A partial repair keeps production running and copies only the damaged rows from the restore with pg_dump --table or a cross-database query from a bastion, which suits a single bad DELETE on one table while the rest of the database kept taking valid writes.
For a cutover, stop writes first (scale workers to zero, put the API in maintenance), take the final restore with --use-latest-restorable-time if you are recovering a lost instance, change the connection setting, and start the app. A connection from your laptop to a private RDS instance is useful for checking row counts on both instances before you switch.
Best fit: any production RDS database. Turn on deletion protection and a 7 to 14 day retention period as soon as the instance holds data you cannot recreate.
Encore brings infrastructure from code. You declare a database in Go or TypeScript, and on AWS Encore provisions it on an RDS for PostgreSQL instance in your own account, by default with Multi-AZ, deletion protection and seven days of backup retention, as listed in the AWS infrastructure docs. Point-in-time recovery is on from the first deploy.
package orders
import "encore.dev/storage/sqldb"
// On AWS this becomes a logical database on the environment's RDS instance,
// covered by its automated backups and point-in-time recovery.
var db = sqldb.NewDatabase("orders", sqldb.DatabaseConfig{
Migrations: "./migrations",
})
The restore runs in the AWS console, because RDS always restores to a new instance. The managing infrastructure docs describe the step after that: open Platform Dashboard > (your environment) > Infrastructure, edit the RDS instance, choose Failover cluster, enter the restored instance ID and deploy. The application then connects to the restored instance, and you keep the original running until you have checked the data. Retention and other backup settings can be changed on the same Infrastructure page or in the AWS console.
For a risky schema change, take a manual snapshot first. Migrations live in the repository and run on deploy, which means an agent proposing a destructive change shows it in the pull request, and a preview environment runs it against a fresh database before production does.
Best fit: teams on Encore who want RDS backups and PITR from day one and a documented path to repoint the app at a restored instance.
Rely on automated backups and point-in-time restore for undoing recent mistakes, and take a manual snapshot before any migration that drops or rewrites data. Use AWS Backup when you need one policy across many accounts or longer archives. On Encore, the backups are already on; the work at restore time is the AWS console restore and the failover setting in the dashboard.
With automated backups enabled, RDS takes a daily snapshot and uploads transaction logs to S3 every five minutes. A point-in-time restore replays those logs on top of the closest snapshot to build a new DB instance at the second you choose, anywhere between the earliest restorable time and LatestRestorableTime.
No. The restore always creates a new DB instance with a new identifier and endpoint. The original instance keeps running, so you either point your application at the new endpoint or copy the data you need back into the original.
As far back as the backup retention period, which can be set from 1 to 35 days for automated backups. Setting retention to 0 disables automated backups and point-in-time recovery.
Run the point-in-time restore in the AWS console, which creates a new RDS instance. Then open the environment's Infrastructure page in the Encore Platform dashboard, edit the RDS instance, choose Failover cluster with the restored instance ID, and deploy so the application connects to it.
Deploy to your cloud on AWS and Google Cloud
without managing infrastructure
Encore lets developers and agents define application infrastructure directly in code, then automatically provisions it from local development to production in your AWS or GCP account.