Move dev to Neon, keep prod on AWS RDS

Build new features on Neon Postgres while keeping your prod database in AWS RDS. Start shipping faster while saving money.

create-neon-twin.ymlon: '0 0 * * *'
capture-start-time1s
dump-and-restoreh1 1m
db-query4s
capture-end-time1s
post-to-slack-success2s
midnight ET24h
Tue, April 8 @8:35:08 AM
SELECT pg_database_size(current_database());
Tue, April 8 @8:35:08 AM
☝️ A new Neon Twin is available!
.github/workflows/create-neon-twin.yml
name: Create Neon Twin

on:
  schedule:
   - cron: '0 0 * * *'
  workflow_dispatch:

env:
  PROD_DATABASE_URL: ${{ secrets.PROD_DATABASE_URL }}
  DEV_DATABASE_URL: ${{ secrets.DEV_DATABASE_URL }}
  PG_VERSION: '16'

jobs:
  dump-and-restore:
    runs-on: ubuntu-latest

    steps:
      - name: Install PostgreSQL
        run: |
          sudo apt update
          yes '' | sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
          sudo apt install -y postgresql-${{ env.PG_VERSION }}

      - name: Dump from RDS and Restore to Neon
        run: |
          /usr/lib/postgresql/${{ env.PG_VERSION }}/bin/pg_dump "${{ env.PROD_DATABASE_URL }}" -Fc -f "${{ github.workspace }}/prod-dump-file.dump"
          /usr/lib/postgresql/${{ env.PG_VERSION }}/bin/pg_restore -d "${{ env.DEV_DATABASE_URL }}" --clean --no-owner --no-acl --if-exists "${{ github.workspace }}/prod-dump-file.dump"

AWS RDS is slowing your team down

AWS RDS is the most widely used Postgres for production workloads, but the developer experience is bare bones — it's hard to build fast on RDS:

  • Provisioning new dev environments takes time.
  • It's hard to keep data in sync between dev and prod.
  • Team collaboration is painful.
  • Dev environments get expensive quick.
The RDS developer experience is not quite there. The AWS console and APIs are quite convoluted and require extensive setup and configuration to achieve even basic tasks.
Guido Marucci - co-founder at Cedalio
Guido Marucci - co-founder at Cedalio
Read more

Move your dev/stage/test environments to Neon

Neon is a serverless Postgres database built to streamline development workflows. Due to its unique architecture, Neon is more agile, efficient, and developer-friendly than any other Postgres.

  • Provisioning new environments takes <1s.
  • Branch data like you branch code.
  • Dev databases scale to zero when inactive.
  • Neon is shockingly affordable.
Neon allows us to develop much faster than we’ve ever been used to. Instead of putting a lot of effort into getting a synthetic dataset within Docker or local Postgres, we just test in a Neon branch, with a perfect copy of production data.
Alex Klarfeld, - CEO and co-founder of Supergood.ai
Alex Klarfeld, - CEO and co-founder of Supergood.ai
Explore case studies

Build a Neon Twin

You can take advantage of Neon's velocity without leaving RDS. Duplicate your RDS dataset in Neon by creating a Neon Twin to host your non-prod environments:

  • Automate the sync between your production database and Neon with a custom GitHub Action.
  • Develop new features and run tests in your dev, stage, and test environments on Neon, using branching to create instant duplicates.
  • When ready, migrate your changes back to RDS with ease.

/ Twin Thing

Twin Workflow
RDS ► Neon

Reverse Twin Workflow
Neon ► RDS
Resynchronize

Twin: Default

This default Action includes one job that runs a pg_dump/restore.

1
GitHub Secrets
PROD_DATABASE_URL=
DEV_DATABASE_URL=
2
name: Create Neon Twin

on:
  schedule:
   - cron: '0 0 * * *'
  workflow_dispatch:

env:
  PROD_DATABASE_URL: ${{ secrets.PROD_DATABASE_URL }}
  DEV_DATABASE_URL: ${{ secrets.DEV_DATABASE_URL }}
  PG_VERSION: '16'

jobs:
  dump-and-restore:
    runs-on: ubuntu-latest

    steps:
      - name: Install PostgreSQL
        run: |
          sudo apt update
          yes '' | sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
          sudo apt install -y postgresql-${{ env.PG_VERSION }}

      - name: Dump from RDS and Restore to Neon
        run: |
          /usr/lib/postgresql/${{ env.PG_VERSION }}/bin/pg_dump "${{ env.PROD_DATABASE_URL }}" -Fc -f "${{ github.workspace }}/prod-dump-file.dump"
          /usr/lib/postgresql/${{ env.PG_VERSION }}/bin/pg_restore -d "${{ env.DEV_DATABASE_URL }}" --clean --no-owner --no-acl --if-exists "${{ github.workspace }}/prod-dump-file.dump"

Resources

Explore our blog posts and guides.

Still have questions?

Interested in learning more about our plans and pricing?

Neon Pump