Skip Navigation
Show nav
Heroku Dev Center Dev Center
  • Get Started
  • Documentation
  • Changelog
  • Search
Heroku Dev Center Dev Center
  • 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 in or Sign 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
    • Buildpacks
  • Developer Tools
    • AI 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
      • Troubleshooting Node.js Apps
      • Working with Node.js
      • Node.js Behavior in Heroku
    • Ruby
      • Rails Support
        • Working with Rails
      • 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
      • Heroku Postgres Advanced (Limited GA)
      • Migrating to Heroku Postgres
    • Heroku Key-Value Store
    • Apache Kafka on Heroku
    • Other Data Stores
  • AI
    • Inference Essentials
    • Inference API
    • Inference Quick Start Guides
    • AI Models
    • Tool Use
    • AI Integrations
    • Vector Database
  • 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
  • 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
    • Heroku AppLink
      • Working with Heroku AppLink
      • Heroku AppLink Reference
      • Getting Started with Heroku AppLink
    • Heroku Connect (Salesforce sync)
      • Heroku Connect Administration
      • Heroku Connect Reference
      • Heroku Connect Troubleshooting
    • Other Salesforce Integrations
  • Databases & Data Management
  • Heroku Postgres
  • Migrating to Heroku Postgres
  • Migrating from Linode Managed PostgreSQL to Heroku Postgres

Migrating from Linode Managed PostgreSQL to Heroku Postgres

English — 日本語に切り替える

Table of Contents [expand]

  • Check Your Database Size
  • Create and Upload the Database Dump
  • Restore to Heroku Postgres
  • Testing and Verifying a Successful Migration
  • Connecting Existing Apps and Services
  • Wrap-up

Last updated June 18, 2026

This article covers migrating to Essential and classic Postgres plans (Standard, Premium, Private, and Shield), and doesn’t apply to Heroku Postgres Advanced (Limited GA) databases.

In this guide, we walk you through the process of migrating your Postgres database from Linode Managed PostgreSQL to Heroku Postgres with a dump and restore strategy. This guide uses Linode Object Storage to store the database dump file. Before starting the migration, make sure you completed the steps from Preparing Your Migration to Heroku Postgres.

Check Your Database Size

With a Linode Postgres database, the easiest way to determine your database size is to query the database directly with the psql client. You can find the Postgres credentials for your database on the database Summary page in the Connection Details section.

Linode connection details

You can put together these pieces of information to create your Postgres connection string. The connection string for using the psql client uses the format:

postgres://DB_USERNAME:DB_PASSWORD@DB_HOST:DB_PORT/DB_NAME

Our example database is called acme_org_db, so we connect our database to the psql client with:

$ psql postgres://akmadmin:my-password@a232051-akamai-prod-183144-default.g2a.akamaidb.net:10033/acme_org_db

After connecting, you can show the database size with the list databases \l+ command:

$ psql=> \l+

                        List of databases
    Name        | Owner     | Encoding |   Collate   | Size   |
----------------+-----------+----------+-------------+--------+
 acme_org_db    | democoder | UTF8     | en_US.UTF-8 | 63 MB |

Usually, the dump and restore strategy for migration is suitable if your database size is less than 100 GB.

The Size column shows our database size is 63 MB.

See Choosing the Right Heroku Postgres Plan for which Heroku Postgres plan fits your database size.

Create and Upload the Database Dump

Before starting, either set your system to read-only mode, or bring all your dependent services offline and notify end users of the current maintenance status.

If your database is attached to a Heroku app, put your app in maintenance mode and downscale any worker dynos that connect to the database.

Back Up Your Database

Before performing the migration, make sure you have a recent backup of your database on Linode. Linode’s managed database plans include regular backups of your database. Depending on your plan and options, you also have the option of manually triggering a backup.

Linode backups

Dump the Database to a Local File

Using pg_dump, create a logical backup of your Linode database to a local file:

$ pg_dump postgres://DB_USERNAME:DB_PASSWORD@DB_HOST:DB_PORT/DB_NAME \
    -Fc -b -v \
    -f /tmp/data-for-migration.sql

The time it takes to run this command varies depending on the size of your database.

Upload the Backup File to Linode Object Storage

Heroku can restore Postgres logical backups that are accessible via a URL. For this migration from Linode, upload your database backup file to Linode Object Storage, then obtain a signed URL for that file.

First, create a bucket. In our example, we named our bucket postgres-for-migration.

Linode create bucket

For security, make sure to set the access policy for your bucket to Private.

Linode private

In addition, make sure your bucket uses proper encryption. After creating the bucket, upload the /tmp/data-for-migration.sql file from the Dump the Database to a Local File step.

Linode upload file

Restore to Heroku Postgres

Create a Heroku App

If you already have your app running on Heroku, you can skip this step.

Use the Heroku CLI to log into your Heroku account.

$ heroku login

Next, create a Heroku app and provide a name for it, such as postgres-migration-from-linode.

$ heroku apps:create psql-migration-from-linode
Creating ⬢ psql-migration-from-linode... done

Provision a Heroku Postgres Add-on

After creating your Heroku app, provision a Heroku Postgres add-on with an appropriate plan. Based on the database information from Check Your Database Size, we use the essential-1 Heroku Postgres plan.

$ heroku addons:create \
    --app psql-migration-from-linode \
    heroku-postgresql:essential-1
Creating heroku-postgresql:essential-1 on ⬢ psql-migration-from-linode... ~$0.013/hour (max $9/month)
Database should be available soon
postgresql-elusive-11582 is being created in the background. The app will restart when complete...
Use heroku addons:info postgresql-elusive-11582 to check creation progress
Use heroku addons:docs heroku-postgresql to view documentation

Heroku begins provisioning a Postgres database for your Heroku app, providing a unique add-on name. Within a few minutes, you can run the following command with the database name to see the created database.

$ heroku addons:info postgresql-elusive-11582
=== postgresql-elusive-11582

Plan:         heroku-postgresql:essential-0
Price:        ~$0.013/hour
Max Price:    $9/month
Attachments:  ⬢ psql-migration-from-linode::DATABASE
Owning app:   ⬢ psql-migration-from-linode
Installed at: Tue May 19 2026 15:29:01 GMT+0000 (Coordinated Universal Time)
State:        created

Get the Signed URL For the Backup File in Linode Object Storage

Next, restore your pg_dump backup to your new Heroku Postgres database. To restore, you need a URL that points to your backup file. With the Linode CLI, generate a signed URL for any resource in Linode Object Storage.

First, run linode-cli configure to authenticate and set up your local machine’s connection with your Linode account. Then, run the obj signurl operation:

$ linode-cli obj signurl \
    postgres-for-migration \
    data-for-migration.sql \
    +300

The arguments for this operation are the bucket containing the object postgres-for-migration, the object name data-for-migration.sql, and the expiration time of the signed URL in seconds. Configure the presigned URL with a reasonable expiration time, such as 5-15 minutes (300-900 seconds), depending on your backup size.

This command also opens a dialog where you can set the expiration time of the generated share link. Choose a reasonable expiration time, then click on the icon at the bottom of the dialog to copy the share URL.

In our example, the signed URL for our database dump file is:

https://us-east-1.linodeobjects.com/postgres-for-migration/data-for-migration-sql?AWSAccessKeyId=NW2B8J3W7BGY7YQWBF4W&Signature=6wk3MJaQageHnDEauBPsIUMNyEE%3D&Expires=1727721969

The presigned URL grants temporary access to your database dump. Use a short expiration time appropriate for your restore duration, and delete the dump file from Linode Object Storage after migration completes.

Restore on Heroku

Now that you have the presigned URL, use the Heroku pg:backups:restore command to restore your backup into your new Heroku Postgres database.

Use the heroku pg:backups:restore command and provide the presigned Linode Object Storage URL for your backup in quotes, and the add-on name to restore your database to:

$ heroku pg:backups:restore 'LINODE-SIGNED-URL-IN-QUOTES' postgresql-elusive-11582 \
    --app psql-migration-from-linode \
    --confirm psql-migration-from-linode

Use Ctrl-C at any time to stop monitoring progress; the backup will continue restoring.
Use heroku pg:backups to check progress.
Stop a running restore with heroku pg:backups:cancel.

Starting restore of [LINODE-SIGNED-URL] to postgresql-elusive-11582... done
Restoring... done

Keep in mind with this command:

  • When you paste in your Linode-signed URL, make sure to contain it within quotes.
  • Provide the --app argument to tell Heroku which application and corresponding database you want to operate on.
  • This command is destructive, requiring you to confirm it. If you don’t provide the --confirm argument, you’re asked to confirm the action before continuing.
  • The restore process automatically reassigns ownership of all schemas and tables to the default Heroku credential. The command doesn’t import roles from the source Linode database because the default Heroku database role doesn’t have permission to create Postgres roles.
  • Make sure that all the extensions used in your Linode database are supported on Heroku Postgres.

Migrate Any Custom Settings

Just as you saved your Linode database configurations to a file called /tmp/settings_postgres.csv, you can do the same for your Heroku Postgres configuration with the command:

$ heroku pg:psql --app psql-migration-from-linode \
    -c "\copy (select * from pg_settings) to '/tmp/settings_heroku.csv' with (format csv, header true);"

Compare your Heroku Postgres settings with your Linode database settings. Find any configurations from your Linode setup and reapply them to your Heroku Postgres instance.

Testing and Verifying a Successful Migration

We recommend testing to verify that data has migrated over successfully. Testing can include:

  • Comparing table counts between the two databases.
  • Comparing row counts for every table between the two databases.
  • Comparing query results between the two databases.
  • Running various acceptance tests on your new database to validate proper behavior and performance.
  • Running the heroku pg:backups:info command to review the logs of your backup restore.

Connecting Existing Apps and Services

After verifying that the database migration was successful, point your existing apps and services to the new database.

Get Heroku Postgres Credentials

When you create the Heroku Postgres add-on, Heroku automatically configures a new environment variable called DATABASE_URL, which contains the connection string for your new database. Run the heroku config:get command to fetch the value of the config var:

$ heroku config:get DATABASE_URL --app psql-migration-from-linode

postgres://ue1eskibf1ind1:p4419f541f3383454eb1e4f2545ed7b7a42634e818a0c77de41f344435ca6812a@cenqjqs4iipva2.cluster-czrs8kj4isg7.us-east-1.rds.amazonaws.com:5432/d9kk4avcoh8j38

You can also find your credentials with the heroku:pg:credentials command.

The Postgres connection string follows this format, so that you can parse the individual pieces:

postgres://DB_USERNAME:DB_PASSWORD@DB_HOST:DB_PORT/DB_NAME

Alternatively, you can obtain the connection string of your database through the dashboard.

Update Dependent Systems and Test

Update your existing systems to point to the Heroku Postgres database using its connection string. Test each system to make sure the connection is successful.

Wrap-up

Now that your apps and services are pointing to Heroku Postgres and running as expected, you can close the maintenance window and restore full availability to your end users.

When you’re confident that the migration is successful and you no longer need your Linode database, you can delete it completely.

With your migration complete, you can now enjoy the flexibility and low-cost convenience of Heroku Postgres. See our Heroku Postgres documentation for more information on using your database.

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
  • © 2026 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