---
title: "Neon Twin: Move Dev/Test/Staging to Neon, Keep Production on RDS"
description: "A Neon Twin is a nightly-synced copy of an RDS Postgres production database kept in Neon for dev, test and staging, so teams get instant provisioning, branching and scale-to-zero without migrating production."
url: "https://swe.quest/articles/neon-twin-move-dev-test-staging-to-neon-keep-production-on-rds-a26cd19df36ac332"
canonical: "https://neon.com/blog/optimizing-dev-environments-in-aws-rds-with-neon-postgres-part-ii-using-github-actions-to-mirror-rds-in-neon"
source: "Neon"
published: "2024-07-24"
difficulty: "medium"
kind: "How-to"
reading_minutes: 7
tags: ["postgres","ci-cd","databases"]
---

# Neon Twin: Move Dev/Test/Staging to Neon, Keep Production on RDS

A post on [Neon](https://swe.quest/sources/neon.md), published 2024-07-24, 7 min read, How-to. Original: [https://neon.com/blog/optimizing-dev-environments-in-aws-rds-with-neon-postgres-part-ii-using-github-actions-to-mirror-rds-in-neon](https://neon.com/blog/optimizing-dev-environments-in-aws-rds-with-neon-postgres-part-ii-using-github-actions-to-mirror-rds-in-neon)

## Summary

A Neon Twin is a nightly-synced copy of an RDS Postgres production database kept in Neon for dev, test and staging, so teams get instant provisioning, branching and scale-to-zero without migrating production. A scheduled GitHub Actions workflow installs Postgres, runs pg\_dump in custom format against RDS, then pg\_restore with --clean, --if-exists, --no-owner and --no-acl into a Neon main branch, with per-engineer branches created from it. Caveats include GitHub Actions' 6-hour job limit (use self-hosted runners for large databases), IP allowlisting problems with GitHub's changing runner IPs, and SSL certificate handling. Co-locating both databases in the same AWS region speeds up the job and cuts egress costs.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [CI/CD](https://swe.quest/tags/ci-cd.md) (Reliability & operations)
- [Databases](https://swe.quest/tags/databases.md) (Data & databases)

## Prerequisites

- PostgreSQL basics ([easy posts on PostgreSQL](https://swe.quest/tags/postgres.md?difficulty=easy))
- GitHub Actions workflows ([easy posts on CI/CD](https://swe.quest/tags/ci-cd.md?difficulty=easy))
- AWS RDS ([easy posts on Cloud platforms](https://swe.quest/tags/cloud.md?difficulty=easy))

## Keywords

Neon, AWS RDS, pg\_dump, pg\_restore, GitHub Actions, Neon Twin

## Related posts

- [Neon Twin: How to deploy a change tested in Neon to prod in RDS](https://swe.quest/articles/neon-twin-how-to-deploy-a-change-tested-in-neon-to-prod-in-rds-09282f8f58bccb12.md): Neon · 2024-08-15 · Medium · 10 min read · Schema migrations, PostgreSQL, CI/CD, Deployment
  Schema changes tested on Neon database branches can be promoted to an AWS RDS production Postgres database through GitHub Actions that run when a pull request merges.
- [How to Set Up Nightly Backups to AWS S3 for Multiple Neon Projects](https://swe.quest/articles/how-to-set-up-nightly-backups-to-aws-s3-for-multiple-neon-projects-8546de66a0aa7f01.md): Neon · 2024-10-29 · Medium · 7 min read · PostgreSQL, CI/CD, Cloud platforms, Databases
  Nightly backups of multiple Neon Postgres databases can be automated with one GitHub Actions workflow per database.
- [How Cedalio uses Neon for an efficient development workflow](https://swe.quest/articles/how-cedalio-uses-neon-for-an-efficient-development-workflow-265835e6a16f5a00.md): Neon · 2024-05-29 · Easy · 5 min read · PostgreSQL, CI/CD, Multi-tenancy, Serverless
  Cedalio, an ESG data verification startup, moved from DynamoDB to Postgres and picked Neon over RDS for a simpler API and console.
- [Neon Twin: Automate Partial Data Dumps with Postgres and GitHub Actions](https://swe.quest/articles/neon-twin-automate-partial-data-dumps-with-postgres-and-github-actions-0e318b92e17657ec.md): Neon · 2025-02-10 · Medium · 7 min read · PostgreSQL, CI/CD, Testing
  A scheduled GitHub Actions workflow can keep a Neon "Twin" refreshed with a partial copy of a production Postgres database.
- [Branching Postgres databases with the Neon API](https://swe.quest/articles/branching-postgres-databases-with-the-neon-api-3faf0de941bc811a.md): Neon · 2022-12-07 · Medium · 3 min read · PostgreSQL, CI/CD, Testing
  Neon branches are copy-on-write clones of a Postgres database that can be created and deleted through the Neon API, giving CI pipelines an isolated copy of production data for end-to-end tests.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
