Skip Navigation
Show nav
Dev Center
  • Get Started
  • Documentation
  • Changelog
  • Search
  • Get Started
    • Node.js
    • Ruby on Rails
    • Ruby
    • Python
    • Java
    • PHP
    • Go
    • Scala
    • Clojure
    • .NET
  • Documentation
  • Changelog
  • More
    Additional Resources
    • Home
    • Elements
    • Products
    • Pricing
    • Careers
    • Help
    • Status
    • Events
    • Podcasts
    • Compliance Center
    Heroku Blog

    Heroku Blog

    Find out what's new with Heroku on our blog.

    Visit Blog
  • Log inorSign up
View categories

Categories

  • Heroku Architecture
    • Compute (Dynos)
      • Dyno Management
      • Dyno Concepts
      • Dyno Behavior
      • Dyno Reference
      • Dyno Troubleshooting
    • Stacks (operating system images)
    • Networking & DNS
    • Platform Policies
    • Platform Principles
  • Developer Tools
    • Command Line
    • Heroku VS Code Extension
  • Deployment
    • Deploying with Git
    • Deploying with Docker
    • Deployment Integrations
  • Continuous Delivery & Integration (Heroku Flow)
    • Continuous Integration
  • Language Support
    • Node.js
      • Working with Node.js
      • Node.js Behavior in Heroku
      • Troubleshooting Node.js Apps
    • Ruby
      • Rails Support
      • Working with Bundler
      • Working with Ruby
      • Ruby Behavior in Heroku
      • Troubleshooting Ruby Apps
    • Python
      • Working with Python
      • Background Jobs in Python
      • Python Behavior in Heroku
      • Working with Django
    • Java
      • Java Behavior in Heroku
      • Working with Java
      • Working with Maven
      • Working with Spring Boot
      • Troubleshooting Java Apps
    • PHP
      • PHP Behavior in Heroku
      • Working with PHP
    • Go
      • Go Dependency Management
    • Scala
    • Clojure
    • .NET
      • Working with .NET
  • Databases & Data Management
    • Heroku Postgres
      • Postgres Basics
      • Postgres Getting Started
      • Postgres Performance
      • Postgres Data Transfer & Preservation
      • Postgres Availability
      • Postgres Special Topics
      • Migrating to Heroku Postgres
    • Heroku Key-Value Store
    • Apache Kafka on Heroku
    • Other Data Stores
  • AI
    • Working with AI
    • Heroku Inference
      • Inference API
      • Quick Start Guides
      • AI Models
      • Inference Essentials
    • Vector Database
    • Model Context Protocol
  • Monitoring & Metrics
    • Logging
  • App Performance
  • Add-ons
    • All Add-ons
  • Collaboration
  • Security
    • App Security
    • Identities & Authentication
      • Single Sign-on (SSO)
    • Private Spaces
      • Infrastructure Networking
    • Compliance
  • Heroku Enterprise
    • Enterprise Accounts
    • Enterprise Teams
    • Heroku Connect (Salesforce sync)
      • Heroku Connect Administration
      • Heroku Connect Reference
      • Heroku Connect Troubleshooting
  • Patterns & Best Practices
  • Extending Heroku
    • Platform API
    • App Webhooks
    • Heroku Labs
    • Building Add-ons
      • Add-on Development Tasks
      • Add-on APIs
      • Add-on Guidelines & Requirements
    • Building CLI Plugins
    • Developing Buildpacks
    • Dev Center
  • Accounts & Billing
  • Troubleshooting & Support
  • Integrating with Salesforce
  • Databases & Data Management
  • Heroku Postgres
  • Migrating to Heroku Postgres
  • Preparing Your Migration to Heroku Postgres

Preparing Your Migration to Heroku Postgres

Last updated March 28, 2025

Table of Contents

  • Downtime Tolerance
  • Prerequisites
  • Gather Information and Configurations
  • Next Steps

Migrating to Heroku Postgres from a different managed-PostgreSQL provider is a simple process. With Heroku Postgres, you get low cost, high performance, and easy resource management. In this article, we walk through the prerequisite steps to complete before the migration process. After completing these steps, see our guides on migrating to Heroku Postgres from the following cloud providers:

  • AWS RDS
  • Google Cloud SQL
  • Azure Database for PostgreSQL
  • Linode Managed PostgreSQL
  • UpCloud Managed PostgreSQL
  • Render PostgreSQL
  • DigitalOcean Managed PostgreSQL
  • Vultr Managed PostgreSQL
  • Aiven for PostgreSQL

Our guides use the “dump and restore” migration strategy for your database. If your database is under 100 GB and you can tolerate a few hours of downtime, this strategy fits most use cases.

Our guides only cover the migration process for the listed databases, but you can use the dump and restore strategy with other databases as well, such as on-premise databases.

 

To learn more about the high-level considerations for migrating Postgres from one cloud provider to another, see Planning Your PostgreSQL Migration.

Downtime Tolerance

The dump and restore approach assumes you can tolerate some downtime in your environment as you migrate. The migration process begins with dumping the entire database schema and data to a file. This step can take minutes or hours, depending on the size of your database. Next, you upload the file to an S3-compatible storage bucket. Finally, using Heroku Postgres, you restore the database from the file.

During the period between dumping the database in storage and restoring it from a file at Heroku, any subsequent updates to the originating database aren’t captured and applied to your Heroku database. It’s important to set your system to read-only mode so you don’t write to the database, or take your systems offline during the migration period.

To be conservative, plan for several hours of downtime.

If your database is attached to a Heroku app, put your app in maintenance mode.

Prerequisites

To start, we assume that you have:

  • A managed instance of Postgres from one of the listed cloud providers
  • Credentials to connect to that database from the command line
  • Access to write to the S3-compatible storage bucket as outlined in each guide
  • A database under 100 GB
  • A Heroku account

Gather Information and Configurations

You need several pieces of information about your Postgres setup at your cloud provider.

1. PostgreSQL version

Use the psql command line utility to connect to your PostgreSQL instance. To see the Postgres version, run the command:

$ psql=> SELECT version();
                                version
--------------------------------------------------------------------------
PostgreSQL 15.8 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-12), 64-bit


(1 row)

In our example, we’re using major version 15.

If your PostgreSQL instance runs an older version of Postgres than what Heroku Postgres supports, you must upgrade to a supported version on your cloud provider’s instance first. It’s easier to troubleshoot if you separate the version upgrade process from the migration process.

2. Extensions

You must install the same extensions in your current database in Heroku Postgres later. To list the extensions you installed on your instance, run the command:

$ psql=> \dx
                    List of installed extensions
  Name   | Version |   Schema   |            Description
---------+---------+------------+------------------------------------
 plpgsql | 1.0     | pg_catalog | PL/pgSQL procedural language
 sslinfo | 1.2     | public     | information about SSL certificates

(2 rows)

Azure database instances include the azure and pgaadauth extensions. You don’t need to install these extensions after migrating to Heroku Postgres.

3. Other Configurations

To capture the configurations for your Postgres database at your cloud provider, you can run psql with a Postgres command to dump your settings to a file:

$ psql postgres://DB_USERNAME:DB_PASSWORD@DB_HOST:DB_PORT/DB_NAME \
    -c "\copy (select * from pg_settings) to '/tmp/settings_postgres.csv' with (format csv, header true);"

The command outputs all settings for your database to /tmp/settings_postgres.csv. Make sure to insert your Postgres credentials and connection information in the Postgres URI.

4. Applications and Services Your Database Uses

Next, gather a list of applications, services, APIs, or other systems that connect to your database. When the time comes to cut over from your cloud provider’s PostgreSQL to Heroku Postgres, you must modify the connection information for each system.

Next Steps

Now that you know your current Postgres version and configuration details, you can start the migration process by following one of our guides for your cloud provider’s PostgreSQL instance.

  • Migrating from AWS RDS to Heroku Postgres
  • Migrating from Google Cloud SQL to Heroku Postgres
  • Migrating from Azure Database for PostgreSQL to Heroku Postgres
  • Migrating from Linode Managed PostgreSQL to Heroku Postgres
  • Migrating from UpCloud Managed PostgreSQL to Heroku Postgres
  • Migrating from Render PostgreSQL to Heroku Postgres
  • Migrating from DigitalOcean Managed PostgreSQL to Heroku Postgres
  • Migrating from Vultr Managed PostgreSQL to Heroku Postgres
  • Migrating from Aiven Managed PostgreSQL to Heroku Postgres

Keep reading

  • Migrating to Heroku Postgres

Feedback

Log in to submit feedback.

Information & Support

  • Getting Started
  • Documentation
  • Changelog
  • Compliance Center
  • Training & Education
  • Blog
  • Support Channels
  • Status

Language Reference

  • Node.js
  • Ruby
  • Java
  • PHP
  • Python
  • Go
  • Scala
  • Clojure
  • .NET

Other Resources

  • Careers
  • Elements
  • Products
  • Pricing
  • RSS
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku Blog
    • Heroku News Blog
    • Heroku Engineering Blog
  • Twitter
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku
    • Heroku Status
  • Github
  • LinkedIn
  • © 2025 Salesforce, Inc. All rights reserved. Various trademarks held by their respective owners. Salesforce Tower, 415 Mission Street, 3rd Floor, San Francisco, CA 94105, United States
  • heroku.com
  • Legal
  • Terms of Service
  • Privacy Information
  • Responsible Disclosure
  • Trust
  • Contact
  • Cookie Preferences
  • Your Privacy Choices