How to export your data from Amazon RDS for PostgreSQL

Amazon RDS gives you no host access, so your exit runs through client-side PostgreSQL tools, logical replication or S3 export. This page explains what each path keeps, what it leaves behind and how long a large move takes.

On this page

How to export data from Amazon RDS for PostgreSQL without host access

Your data leaves Amazon RDS for PostgreSQL through ordinary PostgreSQL client connections: a logical dump, logical replication to an outside subscriber, or a table export to Amazon S3. None of these needs a shell or data directory on the instance, but each moves a different slice of the database, so the first task is an inventory of what you must keep: table data, schema, roles, extensions, large objects and sequence values. The destination can be a self-hosted PostgreSQL server with no license fee for the server software, because PostgreSQL is released under a liberal license similar to the BSD or MIT licenses. Your spending then moves to hardware, storage, operations and support, which the cost section covers.

A logical dump with pg_dump is the path most teams test first. The custom format (-Fc) restores with pg_restore and carries table data, indexes, constraints, views and the CREATE EXTENSION statements. Two points need checking before you rely on it. Extensions only restore if the destination server has the same extension installed, so list every extension on the RDS instance and confirm each one is available outside RDS. Roles are cluster-level objects that pg_dump does not include, so role definitions and memberships must come from pg_dumpall --roles-only, and the RDS master user may not have every privilege that command needs. Large objects are included by default in custom format, and their volume, along with overall database size, will set how long the dump and restore take, so time a restore of a recent snapshot on your destination hardware before you commit to a cutover window.

Logical replication keeps downtime short for large databases. It requires the instance to allow logical replication (the rds.logical_replication parameter, which you should confirm in your RDS parameter group), a publication on the source, and a subscriber on your self-hosted server. PostgreSQL logical replication works across major versions, but it does not copy sequence values or large objects, so those need a final synchronization step at cutover. The S3 export path writes table data to Amazon S3 as files. It suits archives and analytics copies, but it carries no schema, roles or extension definitions, so you must rebuild those separately. Ask AWS to confirm the export and replication limits for your engine version before you plan around them.

What you can export from RDS for PostgreSQL and how

This table maps each part of an RDS for PostgreSQL database to the export method that carries it, the output format and the limits PostgreSQL documents. Use it to decide which combination of pg_dump, logical replication and S3 export covers everything your applications depend on. Items marked for AWS confirmation depend on RDS behavior that the PostgreSQL documentation does not describe.

Data typeExport methodFormat and limits
Schema (tables, indexes, constraints, views)pg_dump with schema-only or full dumpPlain SQL or custom archive; restore with pg_restore or psql into a PostgreSQL server of the same or newer major version
Table datapg_dump, logical replication, or S3 exportDump files keep data and definitions together; S3 export writes data files without schema, so confirm the output format in AWS documentation
Roles and privilegespg_dumpall --roles-only, or manual recreationpg_dump does not dump roles; confirm which RDS master user and reserved roles must be excluded before restore
Extensionspg_dump with CREATE EXTENSION statements, checked against the targetOnly extensions installed on the target server can be restored; confirm RDS-supported extensions and versions in AWS documentation
Large objectspg_dump in custom format, or pg_dumpallPlain SQL dumps need care with large objects; logical replication does not carry them, so plan a separate step
Sequences and current valuespg_dump includes sequence values; logical replication does not replicate sequence stateSet sequence values again on the target after cutover when using replication
Planner statisticsNot carried by pg_dump; reanalyze on the target or use pg_upgrade where applicablePostgreSQL 18 pg_upgrade retains statistics, but that tool runs only on a server you control, so plan ANALYZE after restore

What does not export and how to recover it

A logical dump or subscription moves table data, schema and some objects, but it leaves behind storage files, RDS-managed backups, host settings and cluster-wide objects. Each of these needs its own recovery step on the destination, and each one is easy to forget until cutover.

Roles and privileges

Roles are cluster-wide, so pg_dump does not include them. Their grants on tables are included, but the role definitions are not, which causes permission errors after restore. Capture them with pg_dumpall --roles-only on the source, then review them against the RDS master user, which is not a true superuser. Confirm with your own environment that no application depends on rds_superuser or other RDS-only roles.

Upgrade docs

Tablespaces and their paths

Tablespaces are cluster-level objects and their storage locations are host-specific. A dump records the tablespace name but not the physical location, so objects can fail to restore or land in the wrong place. Recreate each tablespace on the destination with a path that exists there, then restore. Confirm whether your schema uses custom tablespaces at all, since many RDS databases do not.

Storage files and volume snapshots

RDS snapshots and the underlying storage volumes are AWS constructs. They are not portable PostgreSQL data directories, and you cannot copy them to a self-hosted server. Use them only as a rollback copy inside AWS. For the move itself, rely on logical export or replication, and confirm with your team how long snapshots are retained in your account.

Automated backups and point-in-time history

RDS automated backups and their restore points stay inside the RDS service. Continuous archiving on your destination starts fresh, so the source's backup history does not carry over. Before cutover, decide whether you need a final dump kept as a retained archive, and confirm the retention period that your compliance policy requires for that archive.

Archiving docs

Parameter groups and instance settings

Settings in RDS parameter groups, such as rds.logical_replication, shared_buffers, work_mem and connection limits, live in AWS and are not exported. Record each non-default value from the parameter group, then set the equivalent in postgresql.conf or your operator configuration on the destination. Some RDS parameters have no direct equivalent, so confirm each one with your DBA.

Extensions, server-level settings and cluster objects

Extensions are created per database and must be installed again on the destination, and some RDS-supported extensions are not available in a self-hosted build. Database-level and role-level settings set with ALTER DATABASE or ALTER ROLE may also be missed. Compare pg_extension and pg_db_role_setting on both sides, and confirm each extension version is available where you will run it.

Choosing between dump, logical replication and S3 export

This method fits a small or low-write database where the application can stop writing for a maintenance window. pg_dump takes a consistent snapshot at one point in time, so the window must cover the dump, the transfer and the restore, plus checks on the target.

  • What it preserves: Schema, table data, indexes, constraints, views, functions and extensions that the target can install. Roles and cluster-wide objects sit outside pg_dump, so capture them separately, for example with pg_dumpall --roles-only.
  • Writes during the move: Nothing written after the snapshot is captured. Freeze the application before the dump starts, or the restored copy will be missing recent changes.
  • Large objects: Use the custom format (pg_dump -Fc) so pg_restore can handle large objects, then confirm with a test restore that they came across.
  • Extensions: The target must offer the same extensions at compatible versions. Check the extension list against the target before cutover.
  • Time: Total time depends on data volume, index rebuilds and network transfer. Run a timed test restore on a copy so the window is based on measured results.

Before agreeing the window, compare row counts, sequence values and application smoke tests against the restored database.

Export sequence for a complete move, step by step

This sequence takes a PostgreSQL database off Amazon RDS and into a self-hosted cluster with a checked inventory, a restored copy, a verified data match and a controlled cutover. Each step ends with a check you can record before moving on.

  1. Inventory schemas, roles, extensions and large objects

    Your database administrator lists every schema, role and grant, every installed extension, and every large object (the objects stored through the large object interface rather than in ordinary columns). Record the RDS engine version and the extensions in use, then confirm each extension is available on the target server, since some RDS extensions are not packaged for self-hosted PostgreSQL. Done means you hold a written inventory that a second person has reviewed, with each extension marked as available, replaced or unsupported.

  2. Provision the self-hosted target at a supported version

    Your platform or database team builds a self-hosted PostgreSQL server at the same major version as RDS or a newer supported one. The versioning policy lists 14 to 18 as supported, with 18 first released September 25, 2025, so confirm which of these your organization has approved. Install the same extensions at matching versions, apply your authentication settings, and enable SCRAM password authentication. Done means SELECT version(); on the target reports the chosen major version and the extension list matches your inventory.

  3. Create a logical dump or set up logical replication

    Choose between a one-time dump and logical replication, following the PostgreSQL upgrade documentation for each method. For a dump, run pg_dump in custom format against the RDS endpoint, and capture globals with pg_dumpall --globals-only so roles and tablespace definitions are included. For replication, create a publication on RDS, which requires logical replication to be enabled on the instance, and a subscription on the target. Done means the dump file completes without errors, or the subscription reports its tables as ready and replication lag is near zero.

  4. Restore the dump or finish the initial sync

    Restore globals first, then restore the database with pg_restore using parallel jobs where the server can handle the load. If you used replication, wait until every table has completed its initial copy and check that sequences were copied separately, because logical replication does not carry sequence values. Load large objects in the same restore step and confirm their count matches the source. Done means the restore log has no unexpected errors and the target object count matches the inventory.

  5. Verify row counts, checksums and application behavior

    Compare row counts for every table and run checksums or hash comparisons on the largest and most critical tables. Verify sequence values against the source, confirm grants and role membership, and run your application's test suite and read-only checks against the target. Confirm extensions load and functions return the expected results. Done means the verification report shows zero mismatches for every table in scope, signed off by the application owner.

  6. Freeze writes and cut over application connections

    Stop application writes or put the application in read-only mode, wait for replication lag to reach zero or for a final incremental step to finish, and then repeat the sequence and count checks on the changed tables. Point application connection strings or your connection pooler, such as PgBouncer, at the self-hosted endpoint, and keep the RDS instance intact as a fallback. Done means the application runs against the target, a fresh write is visible there, and the cutover record lists who approved it and when.

How data flows from RDS to your self-hosted PostgreSQL

The diagram starts with the RDS instance inside AWS, which is the trust boundary crossed by every export path. An export host inside your network connects over TLS with database credentials and runs either a pg_dump and pg_restore job or a logical replication stream into your self-hosted PostgreSQL subscriber, while an S3 export path writes tables to a bucket for later loading. Every path ends at a verification gate that compares row counts, sequences, roles and extensions before application connections are cut over. Confirm the TLS and credential handling your security team requires for each arrow.

Three export paths from RDS into a self-hosted PostgreSQL target, gated by verification before cutover.

How to verify an export is complete before you cut over

A dump or replica that finishes without errors does not prove the target matches the source. The checks below compare the new PostgreSQL instance with the Amazon RDS source across structure, data, sequences, extensions, privileges and application behavior before any connection string changes. Agree the thresholds for each check with the business owner before the move.

Object counts per schema

Compare the number of tables, indexes, views, functions, triggers and sequences in each schema on RDS and on the target. Run the same catalog queries against both sides and diff the output. A missing index or trigger often causes no error during restore but changes performance or business rules after cutover. Record any intentional difference, such as objects you left out, so the list can be signed off.

Row counts and checksums

Compare row counts for every table, then compute checksums on critical tables and a random sample of larger ones. Counts alone miss updated or corrupted values. For tables that changed during a logical replication window, compare after replication has caught up and writes have paused. Ask the business owner which tables are critical and what mismatch rate, if any, is acceptable.

Sequence values above last use

Sequences are not copied by row data, so a restored sequence can restart below the largest existing ID and cause duplicate key errors on the first insert. Set each sequence to a value above the maximum used in its owning column and confirm the setting on the target. This matters most when the application inserts into the new database before the old one is fully stopped.

Extensions and versions on the target

Confirm that every extension used on RDS exists on the target at a compatible version, and that its objects match the source. Check the extension list and version of each one on both sides. Some extensions available on RDS may be missing on a self-hosted build, and a version gap can change function behavior. Test any extension you cannot install before the cutover window opens.

Role and privilege comparison

Compare roles, role memberships, default privileges and grants on schemas, tables and functions. RDS uses the rds_superuser role instead of a true superuser, so grants that depended on it need a deliberate mapping on the target. Confirm that application roles can log in with the expected authentication method and that no role has more access than it had on RDS.

Application test runs against the new endpoint

Point a staging copy of the application, or a read-only test path, at the new endpoint and run the agreed test suite and key business transactions. Check connection pooling, timeouts, large object reads and any feature that depends on a managed service behavior. Record results against the acceptance criteria in the written scope, and rerun the checks after the final data load.

How long a large database takes to move and what drives it

The time to move a large RDS for PostgreSQL database is set by the size of the data and the path it travels, not by a fixed rule. Logical replication lets a major upgrade finish with only several seconds of downtime, according to the PostgreSQL upgrading documentation, but that figure describes the cutover, not the whole move. The initial table copy and the catch-up period still take time in proportion to the data, so a multi-terabyte database needs a longer copy window than a small one, even when downtime stays short.

Several other factors set the copy duration. The network path between RDS and the export host matters most for dump-based exports, because every byte crosses that link, and cross-region or cross-account transfers add cost and latency. Restore time is often driven by index builds, so a database with many large indexes restores more slowly than its raw size suggests. The number of tables and large objects also adds overhead, and write volume during the copy determines how far the subscriber falls behind and how long catch-up takes. Ask your team to record each of these inputs for your own database before choosing an approach.

Measure instead of estimating. Restore a recent snapshot or a clone of the database into a self-hosted PostgreSQL instance with the same major version and hardware you plan to use, run pg_dump or the replication setup with a realistic write load, and time each phase: dump, transfer, restore, index creation and catch-up. Repeat the rehearsal at least once so you can see variance. Those measured numbers, not vendor claims or rules of thumb, should drive your cutover window and your decision about whether to use logical replication or a dump-based move.

What to plan before the RDS contract ends

The export itself is the easy part. The risks sit in the weeks around it: how long RDS keeps your recovery points, whether a rehearsal has proven the restore, and what happens if the move runs past the contract. Each card names one decision and the person who should own it.

Backup and snapshot retention

Automated backups and manual snapshots are your fallback if an export fails late. Confirm with your AWS account owner how long automated backups remain available once you stop or delete the instance, and whether manual snapshots persist until you delete them. Keep one final snapshot before any cutover and record its identifier. The database owner should sign off on the retention plan, and finance should know that snapshot storage continues to bill after the instance is gone.

PITR docs

Rehearsal on a restored copy

Restore a recent snapshot into a separate instance or self-hosted server, then run pg_dump and pg_restore against it and time each step. Compare row counts, sequences, roles and extensions with production. The rehearsal result tells you whether the cutover window you agreed can hold. The platform lead should own the rehearsal, and the application owner should test read and write paths on the copy.

Extended Support fallback plan

If the move slips, the database may need to stay on RDS past its standard support window. Identify the PostgreSQL major version in use and check it against the supported list: 14 is supported to November 12, 2026, and 13 and earlier are unsupported. Decide in advance whether you would upgrade to a supported major version on RDS or keep the current one under Extended Support. The engineering manager and finance lead should approve that choice together.

Versioning policy

IAM and network access for the export host

The export host needs permission to reach the RDS endpoint, and the S3 export path needs an IAM role with write access to one bucket. Scope both to the minimum: a dedicated database role for the dump user, a security group rule limited to the export host's address, and an S3 policy restricted to the export prefix. The cloud security lead should review these rules and remove them after the export completes.

Dump integrity and verification

Record checksums for every dump file and compare row counts, primary keys and a sample of business totals between RDS and the restored target. Check that extensions, large objects and role grants survived the move, because pg_dump handles them differently from logical replication. The data owner should define the acceptance checks in writing before the export starts.

Sign-off and decision record

Name one person who can approve cutover and one who can invoke the rollback. Write down the criteria for each: verification results, rehearsal timings, and the fallback chosen if the schedule slips. Keep the record with the change ticket so auditors can trace who accepted the data as complete. The service owner signs off on verification, and the compliance lead keeps the evidence.

Can we export our RDS PostgreSQL data ourselves, and what does outside help cost?

Can our team run pg_dump and pg_restore on RDS without help?

Often yes for a small database with a generous downtime window, but the work is mostly in the planning and the rehearsal. pg_dump and pg_restore run from any machine that can reach the RDS endpoint, and the PostgreSQL documentation on upgrading describes dump-and-restore as a supported route for moving a cluster. The effort grows with database size, the number of roles and extensions, and how many applications must reconnect. Before deciding, have an engineer read the PostgreSQL upgrading documentation, run a full dump and restore into a test instance, and time it. Their result is the best input for any quote.

How does logical replication change the effort and the downtime?

Logical replication shifts the work from a single outage to a longer preparation phase, and it shortens the cutover. The PostgreSQL documentation notes that logical replication works between different major versions, which is why it is used for major upgrades with only several seconds of downtime. On RDS, the source must have logical replication enabled through its parameter group, and the team must handle sequences, large objects and schema changes during the sync. Expect more engineering time up front, a monitoring period for lag, and a tested cutover runbook. Confirm the exact parameter names and limits in the AWS documentation for your RDS engine version.

What must our team provide to an outside partner?

Outside help depends on access, a rehearsal environment and named owners. The partner needs read access to the source schema, roles, extensions and sizing data, plus a target environment where the restore can be rehearsed more than once. Your side must name an owner for each application that connects to the database, someone who can approve the cutover window, and someone who signs off the data validation results. Without those owners, rehearsals stall and sign-off drifts. Ask any provider to list these inputs in the written scope before work starts.

What drives the cost of moving a PostgreSQL database off RDS?

Cost is driven by the amount of work the move creates, not by a list price. The main drivers are database size and the time a full copy takes, the number of extensions that need checking on the target, the number of applications and connection strings to change, and how little downtime the business accepts. Each of these adds rehearsal runs, testing and cutover planning. Recurring costs come from the target infrastructure and database administration after the move, which are separate from the one-time migration effort. Ask for the cost components to be itemized: one-time migration work, test environments, and any ongoing support.

Does exporting to S3 replace a logical dump?

No, an export to S3 is a data copy, not a full restore of the database. Exporting tables to Amazon S3 can give you the row data in files, but it does not carry the full set of roles, grants, extensions, functions and configuration that a dump captures. Treat S3 export as one input to the plan, and compare it against a dump restored into a test instance. Confirm what the export feature includes and excludes in the AWS documentation for your engine version, and verify restored row counts and checksums on the target.

How long does a large database take to move?

The honest answer depends on data volume, network path, hardware and how many rehearsals you run, so no single duration applies. Dump and restore time scales with data size and index build time, and restores often take longer than dumps. Logical replication copies the initial data first, then streams changes, so the wait is the initial sync plus the time to catch up. Measure both in a rehearsal on hardware close to production, and build the cutover window from those measurements. Be wary of any quote that gives a duration without first seeing your size and extension list.

Can we keep the migration in-house, and what would outside help add?

Yes, many teams do the migration in-house, and the question is whether they have the time and skills for rehearsal, cutover and validation. PostgreSQL is released under the PostgreSQL License, so the software carries no license fee to self-host. Outside help, such as a fixed-scope engagement from DeployOpen, can cover planning, rehearsal, extension checks, backup verification and documentation for your compliance reviewers, but it does not replace your application owners or your sign-off. Ask for the written scope, deliverables and timelines before deciding.

How DeployOpen scopes and delivers an RDS data exit

DeployOpen plans and implements self-hosted open-source platforms inside your own cloud accounts, data centers or air-gapped networks. For an RDS data exit, that means agreeing in writing which export method fits your databases, building and testing the path to a target PostgreSQL you control, and handing over runbooks and evidence your teams can review.

How we scope

  • Inventory databases, extensions, roles, large objects and sequences to decide between dump, logical replication and S3 export
  • Agree the target PostgreSQL environment, network path and who operates it after handover
  • Confirm the written scope, deliverables and timeline before any work starts, since engagements are fixed-scope

How we build

  • Set up the self-hosted target with the same PostgreSQL major version or a planned upgrade path, and test restores against copies of your data
  • Rehearse the export and import runs, measuring elapsed time on a copy so the production window is based on evidence
  • Check roles, extensions and large objects after each test restore, recording any gaps that need a manual fix

How we hand over

  • Deliver runbooks for the export, validation, cutover and rollback steps, written for your operations team
  • Document the controls and access settings on the target so your compliance and security teams can review them
  • Hand over backup and restore procedures with a record of the test restores performed during the engagement

How we support

  • Support the cutover window and the first period of production operation under the written scope
  • Offer ongoing support, upgrades and continuous testing as a retainer after handover
  • Plan minor and major PostgreSQL upgrades on the target as part of the retainer, if you choose that option

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.