Migrate from Amazon RDS for PostgreSQL to self-hosted PostgreSQL

Moving off RDS for PostgreSQL with little downtime is mostly a logical replication and cutover project. This page covers what moves cleanly, what needs rework, the sequence, and the cost and risk drivers.

On this page

Migrate from Amazon RDS for PostgreSQL to self-hosted PostgreSQL: what the move involves

Most teams start this move for a specific reason: a renewal date, a host-access limit that blocks an extension or tuning change, Extended Support charges on an old major version, or a residency requirement that the managed region cannot meet. The migration is usually a logical replication and cutover project, not a dump-and-restore outage, and its effort profile is set by how many tables, sequences, extensions and application connection strings are involved. Platform engineering provides the hosts, networking and backup design, DBA staff own replication and validation, and application teams own the connection cutover. Many organizations bring in an implementation partner for the replication runbook and the rehearsal. The source RDS instance stays online while the subscriber catches up, so the work is mostly preparation and verification rather than a long freeze.

Start by confirming that the RDS instance has rds.logical_replication enabled in its parameter group and that the target PostgreSQL major version is at least the source version, since logical replication carries the data between major versions. Then list what logical replication does not carry: sequence values, large objects, DDL changes and any extension that is not installed on the target. Sequence values need a planned resynchronization at cutover, and large objects need a separate export path. Extensions that RDS offers but a self-hosted server may not ship, or may ship at different versions, should be tested on a restored copy before the date is fixed. Confirm the authentication method for each application and move clients to SCRAM, since MD5 password authentication is deprecated in PostgreSQL 18. The riskiest step is connection cutover: keep the old endpoint readable for a fallback window, and rehearse the DNS or connection string change with each application team. Ask any partner to show the rehearsal log, the row-count and checksum comparison, and the rollback steps in writing before the cutover window.

Which RDS for PostgreSQL capabilities map to self-hosted PostgreSQL and which need rework

This table maps the main Amazon RDS for PostgreSQL capabilities to self-hosted PostgreSQL with Patroni or CloudNativePG, PgBouncer and WAL archiving, and marks each as clean, needs rework or gap. Read it before scoping the migration, then confirm the RDS-specific items in your own environment, because parameter names and extension availability depend on your account and RDS version.

CapabilitySelf-hosted equivalentStatusWhat to confirm
Multi-AZ failoverPatroni with a distributed configuration store, or CloudNativePG failover through the Kubernetes API serverNeeds reworkDesign quorum, fencing and the failover runbook yourself; PostgreSQL alone does not detect primary failure or notify standbys
Read replicasHot standby servers serving read-only queries, with synchronous or asynchronous replicationCleanConfirm replica lag tolerance and how the application routes read traffic
Automated backups and point-in-time recoveryWAL archiving with base backups; Barman Cloud plugin for CloudNativePG; volume snapshotsNeeds reworkBackups, retention and restore tests are your responsibility; rehearse a point-in-time restore
Parameter groupspostgresql.conf, pg_hba.conf and Patroni or operator-managed configurationNeeds reworkMap each RDS parameter group value to a file or operator setting; confirm which parameters RDS sets for you
rds.logical_replication settingNative wal_level = logical on the source for logical replicationNeeds reworkConfirm the current RDS setting and reboot requirement in your own environment before planning cutover
ExtensionsInstall from packages or images on your servers; PostgreSQL extensions are not all identical to RDS buildsNeeds reworkConfirm each extension in use is available, its version and whether it needs shared_preload_libraries
Major version upgradespg_upgrade, pg_dumpall with restore, or logical replication to a new major versionCleanUpgrade calendar moves under your control; logical replication allows a cutover with only several seconds of downtime
Connection poolingPgBouncer, or built-in PgBouncer management in CloudNativePGCleanConfirm pooling mode works with prepared statements and session settings used by your applications
IAM database authenticationNo direct equivalent; use SCRAM passwords, certificates, GSSAPI, LDAP or OAuth 2.0 methodsGapPlan credential rotation and identity integration; token-based IAM login must be replaced, not copied
Monitoring and metricsPostgreSQL statistics views with exporters and dashboards you operateNeeds reworkRecreate CloudWatch alarms as your own alert rules and confirm retention and on-call ownership

What moves cleanly and what does not

PostgreSQL is released under the PostgreSQL License, a permissive license similar to BSD or MIT, so the engine you run after leaving RDS carries no license fee and no restriction on running it on your own servers. Because the database is still PostgreSQL, most of what you own moves without change: table definitions, rows, indexes, constraints, views, functions written in standard SQL and procedural languages, and the roles and grants that govern access. The practical risk is in what RDS wraps around the engine. Superuser-only operations are unavailable on RDS, so some of your scripts may already avoid them, but a self-hosted server gives you a real postgres superuser, which changes who is allowed to run what. Confirm that every role in your dump is one you intend to keep, and review any ALTER SYSTEM or extension-loading steps that were previously handled by the RDS parameter group.

Extensions and host-level tooling need the most attention. Check every installed extension against the self-hosted build you plan to run, including the exact version and any shared library it requires, because some extensions available on RDS are not packaged in every distribution. Host-level tooling such as RDS snapshots, Enhanced Monitoring, automated minor version patching and Performance Insights has no direct equivalent, so backup, monitoring and patching must be replaced by components you choose and operate. Sequences and large objects need explicit handling. Logical replication does not carry sequence current values to the subscriber, so you must set them on cutover, and large objects stored through pg_largeobject are not published by default, so you need a separate copy step or a dump-based transfer for them. Confirm both with a rehearsal against a copy of production before you plan the window.

The migration sequence from inventory to decommission

The sequence moves an RDS for PostgreSQL workload to a self-hosted cluster in stages, with a rehearsal on a copy, a logical replication sync that keeps lag visible, and a cutover through PgBouncer. Each stage ends with a written output that the client signs off before the next one starts.

  1. Inventory databases, extensions, roles and connections

    DeployOpen works with your database and platform teams to list every database, schema, extension, role, grant, scheduled job and client connection string that touches the RDS instance. The inventory flags extensions that are not available outside RDS, large objects, and any application that hard-codes the RDS endpoint. The output is a written inventory with an owner for each item and a go or no-go list for extensions, which you review before any target hardware is provisioned.

  2. Build the target and rehearse on a non-production copy

    The self-hosted PostgreSQL cluster is built in your own infrastructure with the same major version as the source or a newer one, using the high availability approach agreed in scope, such as Patroni or CloudNativePG. A restored copy of the RDS data is then run through the planned steps, and the team records how long each step takes and which application tests fail. The output is a rehearsal report with the issues found, the fixes applied and a repeatable runbook.

  3. Enable logical replication on the source

    The RDS parameter group is changed so that rds.logical_replication is on, which requires an instance restart, so the change is scheduled with your change control process. The replication role, network path and TLS settings between RDS and the self-hosted subscriber are then tested. The output is a confirmed replication role, a reachable subscriber endpoint and a change record showing the parameter applied.

  4. Publish tables and monitor replication lag

    Publications are created on RDS for the tables in scope, and subscriptions on the self-hosted server copy the initial data and then stream changes. Lag is tracked on both sides, and row counts and checksums are compared for each table before anyone accepts the sync. The output is a synchronized dataset with a lag dashboard, a validation report and an agreed lag threshold for cutover.

  5. Handle sequences and large objects

    Logical replication does not carry sequence values, so the sequences are advanced on the target to match the source at cutover time. Large objects are handled separately, because they are not replicated the same way as ordinary rows, and the approach (migrating them with a dump and restore or another agreed method) is tested in the rehearsal. The output is a sequence reset script and a large object check that confirms counts and sample content on the target.

  6. Cut over application connections through PgBouncer

    Writes are paused or drained according to the agreed cutover plan, final lag is confirmed at zero, sequences are set, and the application connection strings are switched to PgBouncer in front of the new primary. Post-cutover checks cover login methods, roles, application health and key queries. The output is a cutover record with timestamps, the observed downtime against the plan, and a rollback decision point that was closed.

  7. Decommission the RDS instance after a hold period

    The RDS instance stays available for a rollback window agreed in the written scope, while read-only checks confirm the new primary is stable. Backups are verified on the self-hosted side, the final RDS snapshot is retained according to your retention policy, and the instance is then deleted and its IAM, security group and parameter group entries are removed. The output is a decommission record, an updated architecture document and evidence for your compliance team.

Logical replication keeps the self-hosted subscriber current until cutover

The flow starts at the RDS publisher, where logical replication publishes the tables being moved. Changes stream to a self-hosted subscriber run by Patroni or CloudNativePG, and PgBouncer sits in front of the applications so connections can move with a single change. Before any cutover decision, teams run a parallel-run validation stage against the subscriber. If validation fails, the path returns applications to RDS, so confirm the rollback path, the replication lag and the state of sequences before you move any traffic.

Logical replication feeds the self-hosted subscriber until validation decides the cutover.

Data and integrations to move and rebuild

Moving off RDS is more than copying rows. Schema, roles, extensions, sequences, large objects, connection settings and the operational tooling around the database each need a deliberate path. The cards below group the items that most often break a cutover, so each can be assigned, tested and signed off before the switch.

Schema and data through logical replication

Logical replication publishes tables from the RDS source to a self-hosted subscriber, so changes keep flowing until cutover. On RDS, the rds.logical_replication parameter must be enabled in the parameter group, which typically requires an instance restart. Confirm the publication scope, replica identity for tables without primary keys, and how DDL changes will be handled during the sync window, since logical replication does not copy schema changes automatically.

Upgrade docs

Roles, grants and extensions with pg_dump

Logical replication carries table data, but not the global objects that surround it. Use pg_dumpall --globals-only or equivalent to capture roles and tablespace definitions, then pg_dump --schema-only for object definitions and extension statements. Extensions that RDS offers may be missing or at different versions on your servers, so check each one against your target image before you plan the cutover. Confirm exact flags with your environment.

Sequences resynchronized at cutover

Logical replication does not copy sequence values, so identity columns and serial defaults on the subscriber can lag behind the source. Before accepting writes on the new primary, set each sequence to the maximum value in its table plus a safety margin. Automate this as a scripted step in the cutover runbook and verify it with a test insert on each sequence-backed table.

Large objects and binary data

Large objects stored through the pg_largeobject interface are not published by default logical replication, so they need a separate copy path, typically pg_dump with large object support or a pg_restore pass. Inventory which tables reference OIDs of large objects, and check your application for any code that streams binary data through that interface. Test a restore of the largest object set to measure the time it takes and confirm checksums match.

Connection strings and secrets

Application connection strings usually point at RDS endpoints and hold credentials that live in parameter stores or CI variables. Plan the new host names, TLS settings, the password or certificate authentication method for each role, and the connection pooler in front of the database. Rotate credentials as part of the cutover so that the RDS master credentials are not reused. Confirm exact settings with your application owners and security team.

Backup, monitoring and alert rewiring

RDS provides automated backups, snapshots and CloudWatch metrics that teams often rely on without noticing. On self-hosted PostgreSQL, the equivalent includes WAL archiving with point-in-time recovery, scheduled base backups, restore tests and an exporter feeding your monitoring stack. Rebuild alerts for replication lag, disk, connection count and backup failures before cutover, and rehearse a point-in-time restore from your new archive.

Archiving docs

How the migration changes by starting point

A single RDS for PostgreSQL instance with one application and a defined maintenance window is the simplest starting point. A logical replication cutover is still possible, but many teams accept a short write freeze and use a dump and restore instead, since the window already exists and the operational risk is low. The target can be a single PostgreSQL server on a VM with a tested backup routine, with failover handled as a documented manual procedure.

  • Replication: Optional. A dump and restore inside the window may be enough, or a logical subscriber can keep the gap short if the window is tight.
  • Failover: Usually manual at first. Confirm who can promote a standby or restore from backup, and how long that takes in your environment.
  • Staffing: One database administrator, or an application engineer with DBA support, typically covers the work.
  • Backups: Set up base backups and WAL archiving before cutover, not after.
  • Extensions: Check every extension in use against what your target build provides.

Confirm the maintenance window length with the application owner, and rehearse the full cutover on a copy of the data.

How to run both databases in parallel and cut over safely

The safest way to leave RDS is to keep the RDS instance as the publisher while a self-hosted PostgreSQL server subscribes to it, so both databases hold the same data until you decide to switch. Enable rds.logical_replication in the RDS parameter group, confirm the publication covers every table that the application writes, and create the subscriber on your own servers. Before any traffic moves, compare row counts and run checksums or key-based comparisons on the subscriber for the largest and most write-heavy tables, and record the replication lag over several business cycles. Sequences do not replicate through a standard publication, so plan a separate step that sets each sequence on the new server to the value on RDS at cutover. Large objects also need their own handling, so confirm how your application stores them before you rely on this path.

Next, replay application test traffic against the self-hosted subscriber, or run a staging copy of the application pointed at it, and check that queries, extensions, roles and authentication behave the same. Test every extension your workload needs on the self-hosted server, because the set available outside RDS can differ from the set on RDS. Major version upgrades can also use logical replication, which the PostgreSQL upgrading documentation describes as allowing only several seconds of downtime, so a version change can be combined with the move if the target version is supported. Define the cutover point in writing: a freeze window, the final lag check, the sequence sync, the connection string switch and the owner of each step. Also define the rollback path, which is usually to point applications back at RDS and keep a reverse subscription in place for a period you agree in advance.

Confirm during design whether the self-hosted cluster needs synchronous replication and quorum commit for standbys. These are configuration choices with a direct effect on commit latency and on how many standbys must acknowledge a write before the primary reports success, so they should be decided with your recovery objectives in mind and not left at defaults. Ask your DBA team and your platform owner to write down the standby count, the commit policy and the failover owner, and test a failover before cutover, not after. Record every decision, check and sign-off, because compliance reviewers will ask for evidence of the parallel run as much as for the final result.

What drives migration cost and duration

This table lists the drivers that change how much a move from Amazon RDS for PostgreSQL to self-hosted PostgreSQL costs and how long it takes, with a way to reduce each one. Read the rows as a checklist to size the work before asking for a fixed-scope quote, and note which costs are one-time and which recur after cutover.

DriverWhy it changes cost or effortHow to keep it down
Database size and write churnInitial copy time and the replication backlog both grow with data volume and the rate of changes, which sets how long the logical replication catch-up and cutover window take.Measure size and write rate on the RDS instance first, then replicate large, quiet tables early and schedule the final cutover during a low-traffic window.
Number of databases and extensionsEach database needs its own publication and subscription. Extensions that RDS supports may be missing, differently versioned or require superuser rights on your servers.Inventory every database and extension with their versions, then test the extensions you need on a self-hosted instance before committing to the plan.
Large objectsLogical replication does not carry large objects by default, so they need a separate export and import path, which adds steps and verification time.Count and size large objects per database, then decide whether to move them with a dump-and-restore step during the cutover window.
Sequence count and valuesLogical replication does not synchronize sequence values, so each sequence must be set on the new primary at cutover or applications risk duplicate key errors.Script the sequence sync as a cutover step and verify values against a dry run.
Application connection changesConnection strings, DNS names, secrets, TLS settings and any RDS-specific IAM authentication must change in every service, and each change needs its own test.Centralize connection settings in configuration or a service discovery layer, and move clients to certificate or SCRAM-based authentication before the cutover.
Required failover designRDS Multi-AZ failover is included in the service. A self-hosted design needs a chosen tool such as Patroni or CloudNativePG, a distributed configuration store or Kubernetes, and tested failover runbooks.Decide the high availability model before migration, then rehearse switchover and failover in a non-production copy of the environment.
Backup target and point-in-time recoveryBackups to object storage, WAL archiving and restore testing must be built and operated. Backup storage and retention costs recur monthly, and restore tests take staff time.Choose the backup target and retention period early, automate WAL archiving, and run a timed restore test before go-live.
Monitoring and alertingRDS exposes built-in metrics. Self-hosted monitoring for replication lag, disk, connections and backups must be deployed and kept current.Reuse the organization's existing monitoring stack where possible and define alerts for replication lag and backup failures before cutover.
Team skills and ongoing DBA timePatching, minor and major upgrades, tuning and on-call response move from the cloud provider to your team. This is the largest recurring cost and is hard to estimate without the team's current skills.Assess existing PostgreSQL expertise, plan training or outside support, and ask any provider to show the operations work they will hand over in writing.

What usually goes wrong and how to prevent it

Most failed RDS exits do not fail on the data copy itself. They fail at cutover, when sequences lag, extensions are missing, old endpoints stay in configuration, or no one can return to RDS. Each risk below has a check to run before the cutover window opens.

Sequences not advanced at cutover

Logical replication copies table rows but does not carry sequence values forward, so the new primary can hand out IDs that already exist. Before switching writes, read the current value of every sequence on RDS and set the matching sequence on the subscriber to a value above it, with a safety margin. Then compare a sample of inserts on both sides. Treat this as a checklist item for every schema, not a one-time fix for a single table.

PostgreSQL upgrade docs

Large objects and unsupported schema changes

Large objects stored through the pg_largeobject interface are not part of a standard table publication, so they can be missing on the subscriber even when every table has synced. Schema changes made on the publisher after the initial copy, such as new columns or new tables, also need matching DDL on the subscriber before replication continues. Inventory large objects and DDL activity in the weeks before the move and confirm how each is carried across.

Extensions missing on the self-hosted build

RDS offers a curated set of extensions, and some of them are not installed by default in a community PostgreSQL image or operator build. Compare the extension list on your RDS instance with the packages on the target, then load the schema into a staging server and run the queries that depend on each extension. Confirm the exact package versions with your extension maintainers, since a version mismatch can block the restore.

Connection strings pointing at the old endpoint

Applications, batch jobs, reporting tools and scheduled scripts often hold the RDS hostname in configuration files, secrets stores or connection pool settings. Any consumer that is missed keeps writing to the old database after cutover, or reads stale data from it. Build an inventory from application configs, secrets managers and network logs, change endpoints through one controlled release, and keep the RDS instance read-only so a missed client fails loudly.

Failover tooling not tested

PostgreSQL does not detect a failed primary or promote a standby on its own, so the high availability layer you choose has to be exercised before production traffic depends on it. Patroni or CloudNativePG should be tested with a planned switchover and an unplanned primary stop, and the team should confirm that clients reconnect through the expected path. Record the observed behavior and repeat the test after every upgrade of the tooling.

PostgreSQL failover docs

Cutover without a rollback plan

Once writes land on the new server, going back to RDS means replaying those writes in reverse, which requires a second replication path. Decide before the window opens which trigger leads to a rollback, who authorizes it, and how long the team will keep the original RDS instance available. Rehearse the reverse path on a copy of the data so the decision is based on tested steps rather than assumptions.

Questions buyers ask before moving off RDS for PostgreSQL

How much effort does moving off RDS for PostgreSQL take?

The effort depends mostly on database size, the number of extensions in use, how many applications connect, and how much of the RDS setup your team has automated. The core work is standing up self-hosted PostgreSQL, configuring high availability and backups, setting up logical replication from RDS to the new subscriber, testing the application against the new environment, and rehearsing cutover. Each item adds effort in proportion to the number of databases and workloads involved. Ask any provider for a written list of tasks, the environments in scope, and the test cycles included before accepting a quote. Your own inventory of extensions, roles and connection paths will shape that list more than any general estimate.

How long can cutover downtime be during a move?

Downtime depends on how the migration is done and how much write traffic the database receives during the final sync. The PostgreSQL upgrading documentation notes that logical replication between major versions allows a major upgrade with only several seconds of downtime, which shows what a well-prepared logical replication cutover can look like. Downtime is driven by replication lag at the moment you stop writes, the time to repoint application connection strings or a connection pooler, and how long sequence values take to synchronize. Confirm the expected write freeze window in a rehearsal in a non-production copy before you commit to any maintenance window.

Can our own team migrate PostgreSQL without outside help?

A team with solid PostgreSQL operations experience can usually run the move internally, but the work is less about the copy itself and more about the surrounding controls. The main risks are unsupported extensions, sequences and large objects that logical replication does not carry as expected, and application behavior at cutover. Outside help is most useful for fixed-scope work such as a readiness assessment, a rehearsed cutover plan, or a migration of many databases on a deadline. DeployOpen plans, implements, tests and documents self-hosted open-source platforms in your own infrastructure, and engagements are agreed in writing before work starts. Ask any partner to show how they will verify data consistency before cutover.

What skills and staff does a self-hosted PostgreSQL platform need?

Running PostgreSQL yourself needs people who can operate the database, the high availability layer and the backup system, along with the infrastructure beneath them. For a Patroni-based design, the team needs to understand the distributed configuration store, the REST API for switchover and failover, and the replication settings. For a CloudNativePG design, the team needs Kubernetes operations skills, storage class knowledge and familiarity with the operator's failover and backup behavior. In both cases, someone must own patching, minor release updates, monitoring, capacity and on-call response. Patroni and CloudNativePG are open source and have no license fee, but their staffing cost recurs every month. Check the skills in your own team before choosing the architecture.

Which PostgreSQL versions and extensions work outside RDS?

PostgreSQL is released under the PostgreSQL License, and the supported major versions are 18 (to November 14, 2030), 17 (to November 8, 2029), 16 (to November 9, 2028), 15 (to November 11, 2027) and 14 (to November 12, 2026), according to the PostgreSQL versioning policy. Versions 13 and earlier are no longer supported, so choose a target from the supported list. Extensions are the bigger question. Some extensions available on RDS may not be packaged for your target version or may require a different build on self-hosted servers, and a few RDS-specific features have no direct equivalent. Build an inventory of every installed extension and test each one against the exact target version before cutover.

What happens to backups and point-in-time recovery after the move?

Backups do not move with the database, so you must build a new backup and recovery design before you retire RDS. On self-hosted PostgreSQL, point-in-time recovery depends on continuous WAL archiving, a base backup strategy and tested restores. The PostgreSQL continuous archiving documentation describes the mechanism, and CloudNativePG documents backups to object storage through the Barman Cloud plugin, volume snapshots and WAL archiving with point-in-time recovery. Costs include the object storage or volume capacity for base backups and WAL, the network and compute for restore tests, and the staff time to monitor the archive. Keep RDS snapshots available until a restore from the new system has been proven in a test.

Does an outside partner or our own team carry the security and compliance evidence?

Your organization remains responsible for its controls, and self-hosting moves evidence collection onto your team. You will need to document authentication, encryption, access control, audit logging and backup testing for the new platform. PostgreSQL documents authentication methods including password, GSSAPI, SSPI, LDAP, RADIUS, certificate, PAM and OAuth, and PostgreSQL 18 deprecated MD5 password authentication in favor of SCRAM. DeployOpen prepares systems, controls and evidence for compliance assessments, but it does not issue audit reports, attestations or certifications. Independent auditors and certification bodies perform those assessments. Confirm early which evidence your assessor expects.

How DeployOpen scopes and runs the migration

DeployOpen plans, implements, hardens, backs up, documents and supports self-hosted PostgreSQL inside your own infrastructure, whether that is your cloud accounts, data centers or an air-gapped network. Most engagements are fixed-scope, so the first step is a written scope that names the source RDS instance and major version, the target hosts or Kubernetes cluster, the databases and schemas to move, the extensions in use, the cutover window your application owners will accept, and the controls your compliance team needs to review. The scope document fixes the deliverables and timelines before any work starts. A quote follows from that written scope, so the variables that move the price are the same ones you should check first: database size, number of publications, how many extensions must be re-validated outside RDS, and how much of the high availability and backup design is new to your team.

The scope should also decide who owns each step after handover. For a logical replication migration, that means agreeing on who creates the publication on the RDS side, who sets up the subscriber on the self-hosted side, how sequences are synchronized before cutover, and who signs off on large object handling and the connection string change in the application. The deliverables typically cover the target build, the high availability design (Patroni or CloudNativePG, as chosen in the scope), backup and restore tests, runbooks and the evidence your auditors will ask for. Confirm with us in writing whether the scope includes a rehearsal of the cutover and a rollback plan, because those tests are where the real risk sits.

Ongoing support is available as a retainer for patching minor releases, planning major upgrades, reviewing backups and handling incidents after go-live. Ask for the retainer terms in the same written form as the migration scope: response expectations, which named tasks are covered, and how upgrades to a new major version are priced and scheduled. Your own internal effort should not be left out of the quote, since application testing, change approval and on-call coverage remain with your teams even when DeployOpen runs the database platform.

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.