Updated Nov 23, 20269 min read

How to Migrate Render Postgres to Amazon RDS

Move a Render Postgres database into Amazon RDS in your own AWS account with pg_dump and pg_restore, a short write freeze and a checked cutover, then point the app at it from Encore or a hand-built RDS setup.

Illustration for How to Migrate Render Postgres to Amazon RDS

To migrate Render Postgres to Amazon RDS, create an RDS for PostgreSQL instance on the same or a newer major version, dump the Render database over its external URL with pg_dump --format=custom, and load it with pg_restore during a short write freeze. Check row counts and sequences, then point the app at RDS.

With Encore, the RDS instance comes from a database declared in your code, so the target exists after the first deploy to your AWS account.

Why move Render Postgres to RDS?

Render Postgres is often the database added next to a team's first Render web service, and it stays easy until the app needs something outside Render: a worker that reads SQS, a data pipeline that wants a private connection, or an AWS credit balance that the Render invoice cannot use. Moving the data is the smaller part of the job, since the database also needs a new home with private networking, backups and a way for the app and CI to reach it.

This guide moves a Render Postgres database into Amazon RDS in your own AWS account with standard Postgres tools, then covers two ways to stand up the RDS side: with Encore, which provisions RDS from the database declared in your code, and by hand.

What are the steps of a Render to RDS migration?

StepWhat you runDowntime
1. Check the sourceSELECT version();, extension list, database sizeNone
2. Create the RDS targetEncore deploy or Terraform/consoleNone
3. Rehearsal dump and restorepg_dump then pg_restore into RDSNone
4. Freeze writesMaintenance mode or scale web and workers to zero on RenderStarts here
5. Final dump and restoreSame commands as the rehearsalDuring freeze
6. VerifyRow counts, sequence values, a smoke testDuring freeze
7. Cut overPoint the app at RDS and resume trafficEnds here

Step 1: What should you check on the Render database?

Render shows an internal and an external connection URL on the database's page in the dashboard, and the external one only accepts connections from IPs listed under the database's access control, as described in Render's Postgres docs. Add your machine's IP and record three things before you create the target:

SELECT version(); SELECT extname, extversion FROM pg_extension; SELECT pg_size_pretty(pg_database_size(current_database()));

The RDS major version should match or exceed the Render one, and every extension in the list has to be supported on RDS for PostgreSQL, which covers common ones such as pgcrypto, uuid-ossp, pg_trgm and vector. The size tells you how long the write freeze will last.

Step 2: How do you create the RDS target with Encore?

Encore

Encore is a backend framework with built-in infrastructure, and its platform provisions and deploys into your own AWS or GCP account. The database the Render app used becomes a declaration in the backend code, and deploying it to an AWS environment creates an RDS for PostgreSQL instance in private subnets, encrypted at rest, with backups and a database role for each service that uses it, as listed in the AWS infrastructure docs. When you create the environment you can pick Amazon Aurora PostgreSQL instead of RDS, or import an RDS instance you already have.

The Infrastructure page in the Encore dashboard with a database's configuration panel open, showing fields for vCPUs, memory, storage, availability type, max connections and backups.
Each provisioned database can be reviewed and its configuration edited per environment in the Encore dashboard. The screenshot is an example of that infrastructure view in a GCP environment, showing a Cloud SQL database.

Set up the app

Get started
brew install encoredev/tap/encore &&
encore app create
Copy

Run in your terminal to get started locally.

~
$ encore app create shop --example=ts/hello-world$ cd shop && mkdir -p orders/migrations

Start the migrations folder with a bootstrap migration taken from the Render schema, the approach the import docs describe for existing databases, so every new environment gets the same tables from scratch:

~/shop
$ pg_dump "$RENDER_EXTERNAL_URL" --schema-only --no-owner --no-acl > orders/migrations/1_bootstrap.up.sql

Review the file and remove anything Render-specific, such as CREATE EXTENSION lines for extensions you no longer use. The service then declares the database where the queries live:

// orders/orders.ts import { api, APIError } from "encore.dev/api"; import { SQLDatabase } from "encore.dev/storage/sqldb"; // Postgres locally with `encore run`, Amazon RDS when deployed to AWS. const db = new SQLDatabase("app", { migrations: "./migrations" }); interface Order { id: number; status: string; } export const get = api( { expose: true, method: "GET", path: "/orders/:id" }, async ({ id }: { id: number }): Promise<Order> => { const row = await db.queryRow<Order>` SELECT id, status FROM orders WHERE id = ${id} `; if (!row) throw APIError.notFound("order not found"); return row; }, );

After the first deploy to a production environment on AWS, the RDS instance exists with the bootstrap schema applied, and it is not reachable from the internet. The Encore CLI opens a local proxy to it, and encore db conn-uri prints a temporary connection string for the restore in Step 3. Both commands default to a read-only connection, so the --write flag is required for pg_restore to insert rows:

~/shop
$ encore db proxy --env=production --write$ encore db conn-uri app --env=production --write

Both commands are covered in the database CLI docs, and later schema changes are applied as numbered migration files on each deploy. Locally, encore run starts Postgres with the bootstrap schema applied, so every developer works against the same tables as production instead of the shared Render instance, with seed data or a trimmed dump loaded by pg_restore. A coding agent working in the repo can then add a column with a migration file in the same change as the query that uses it, and test it against that local copy before it touches RDS. You bring the agent; Encore provides the local environment, the system context and the deploy controls.

Production SQL databases created this way have deletion protection enabled at the AWS level, per the infrastructure management docs, and every query shows up in the local development dashboard while you test the cutover.

Best fit: Teams leaving Render who want the database to land in RDS in their own AWS account, provisioned from the code that queries it, with the API, workers and cron jobs moving with it.

Step 2 (alternative): How do you create the RDS target by hand?

Without Encore, the target is an aws_db_instance or a console-created instance with a DB subnet group across two private subnets, a security group that accepts 5432 only from the app's security group, a parameter group for the major version, and the master password in Secrets Manager. The instance is private, so the restore in Step 3 has to run from inside the VPC, for example from a small EC2 instance or an SSM Session Manager port forward, and the app's task role needs secretsmanager:GetSecretValue on the credentials. Create an RDS Postgres Database Without Terraform reaches the same database without any of it.

Best fit: Teams whose AWS account already has a VPC and RDS modules owned by a platform team.

Step 3: How do you rehearse the dump and restore?

Run the full copy once while Render keeps serving traffic. The schema already exists on RDS from the bootstrap migration, so the dump only needs the data. --format=custom produces a compressed archive that pg_restore can load in parallel, and --no-owner --no-acl drops Render's role names, which do not exist on RDS:

~
$ pg_dump "$RENDER_EXTERNAL_URL" --data-only --format=custom --no-owner --no-acl -f render.dump$ pg_restore --data-only --no-owner --no-acl --jobs=4 -d "$RDS_URL" render.dump

$RDS_URL is the connection string from encore db conn-uri with the proxy running, or the instance endpoint when you built RDS by hand and restored the full schema and data instead of data only. Use a pg_dump client at least as new as the Render server version, and note how long both commands take, since the sum is roughly the write freeze. A data-only dump of tables with circular foreign keys produces a warning from pg_dump, and those constraints need to be dropped and re-added around the restore. The pg_dump documentation lists every flag. Empty the tables with TRUNCATE ... RESTART IDENTITY CASCADE before the final run.

Steps 4 to 6: How do you freeze writes, copy and verify?

Stop writes on Render, either with a maintenance page or by scaling the web service and any background workers or cron jobs to zero, so no row changes after the dump starts. Run the same dump and restore, then compare the two sides:

-- Run on both databases and diff the output. SELECT relname, n_live_tup FROM pg_stat_user_tables ORDER BY relname;

n_live_tup is an estimate, so for the tables that matter run an exact SELECT count(*). pg_dump carries sequence values across, and it is worth checking that SELECT last_value FROM orders_id_seq; matches on both sides, since a sequence behind the data is what produces duplicate key errors on the first insert after cutover.

Step 7: How do you cut over?

With Encore, the app already reads from the RDS database on its next deploy, so cutting over means deploying the services that replace the Render ones and moving DNS to the Encore environment's endpoint. With a hand-built setup, update DATABASE_URL on the app to the RDS endpoint and restart. Keep the Render database for a few days in read-only use as a fallback, then delete it once the RDS backups have run.

Which way should you set up the RDS side?

  • Encore if the API, workers and cron jobs are moving off Render too, and you want the database declared next to the code that queries it, with the same schema in every environment.
  • By hand or with Terraform if a platform team already owns the VPC and RDS modules and only the data is moving.

Verdict. The dump, restore and checks are identical on both paths, so the write freeze is the same length. The difference is what you maintain afterwards: an RDS module, a subnet group and a secrets policy, or a database line in the code.

Frequently asked questions

How do I migrate a Render Postgres database to Amazon RDS?

Allow your machine's IP in the Render database's access control, run pg_dump --format=custom --no-owner --no-acl against the external database URL, then run pg_restore --no-owner --jobs=4 into an RDS instance with the same or newer Postgres major version. Stop writes before the final dump, compare row counts per table, and switch the app's connection to RDS.

How do I restore a Render dump into an Encore database on AWS?

Declare the database in code with new SQLDatabase("app", { migrations: "./migrations" }) and deploy once so Encore creates the RDS instance. Then run encore db proxy --env=production --write, take the connection string from encore db conn-uri app --env=production --write, and run pg_restore against it from your machine.

Which fits a move off Render better, RDS or Aurora?

RDS for PostgreSQL is the closer match to a single Render Postgres instance and the cheaper one at rest. Aurora PostgreSQL makes sense when you want storage that grows on its own, read replicas across Availability Zones or Aurora Serverless v2. The pg_dump and pg_restore steps are the same for both.

How long does a Render to RDS migration take?

The write freeze lasts as long as one dump and restore of the final data. AWS treats [pg_dump and pg_restore as a fit for databases from a few gigabytes up to a few hundred](https://aws.amazon.com/blogs/database/best-practices-for-migrating-postgresql-databases-to-amazon-rds-and-amazon-aurora/), and a [14 GB test database dumped and restored in about eight minutes](https://aws.amazon.com/blogs/database/migrating-databases-using-rds-postgresql-transportable-databases/). Time still depends on network, instance size and schema, so measure a dry run before you book the window.

Do I need the same Postgres version on RDS as on Render?

No. It can be newer but not older. The RDS major version should be equal to or newer than the Render version, because pg_restore does not reliably load a dump into an older server. Check the source with SELECT version(); before creating the target.

Own your AWS or GCP cloud without giving up PaaS speed

Define databases, Pub/Sub, cron jobs, and object storage directly in TypeScript or Go. Encore provisions everything in your own cloud account with zero Terraform or lock-in.

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