Nov 18, 20266 min read

RDS Point-in-Time Recovery: Backups, Restore and Retention

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.

Illustration for RDS Point-in-Time Recovery: Backups, Restore and Retention

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.

Point-in-time recovery at a glance

Automated backupsManual snapshotsAWS Backup continuous
Restore granularityAny second within retentionThe snapshot momentAny second within its window
Retention1 to 35 daysUntil you delete themUp to 35 days
Survives instance deletionOptional (retain automated backups)YesYes
Restore targetNew instanceNew instanceNew instance
Use whenUndoing a bad write from earlier todayBefore a risky migration, or for long-term archivesCentral backup policy across accounts

The RDS backup documentation lists the retention limits and explains how the backup window is chosen.

Check retention and the restorable window

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.

~
$ aws rds describe-db-instances --db-instance-identifier orders-prod \ --query 'DBInstances[0].[BackupRetentionPeriod,LatestRestorableTime]'[ 7, "2026-11-18T08:41:12+00:00"]$ aws rds modify-db-instance --db-instance-identifier orders-prod \ --backup-retention-period 14 --apply-immediately

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.

Restore to a timestamp

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.

~
$ aws rds restore-db-instance-to-point-in-time \ --source-db-instance-identifier orders-prod \ --target-db-instance-identifier orders-restore \ --restore-time 2026-11-18T09:11:00Z \ --db-subnet-group-name orders-db-subnets \ --vpc-security-group-ids sg-0abc1234 \ --db-parameter-group-name orders-pg18 \ --db-instance-class db.m5.large \ --multi-az$ aws rds wait db-instance-available --db-instance-identifier orders-restore

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.

What the restored instance does not inherit

The new instance is built from storage, not from the original's configuration. Check these before sending traffic:

SettingWhat happens on restoreWhat to do
Security groupsDefault VPC security group unless you pass onePass --vpc-security-group-ids
Parameter and option groupsDefault groups unless you pass themPass --db-parameter-group-name
TagsLatest tags from the source, unless you pass --tagsCheck tags that drive cost reports or backups
Storage performanceVolumes keep loading blocks from S3 in the backgroundExpect slower queries until initialization finishes
Deletion protectionOff unless you set itmodify-db-instance --deletion-protection
EndpointNew hostnameUpdate the app's connection settings or DNS
Database users and passwordsAs they were at the restore timeRotate if the incident involved credentials

Cut over, or copy the data back

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.

How do you restore an Encore database on AWS?

Encore

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.

How to choose

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.

Frequently asked questions

How does RDS point-in-time recovery work?

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.

Does RDS point-in-time restore overwrite my database?

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.

How far back can I restore an RDS instance?

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.

How do I restore an Encore database on AWS to a point in time?

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.

~/orders — claude
Claude Code
Claude Code v2.1.180Opus 5.5~/orders