{
  "id": "neon",
  "title": "Prepare Neon for RDI",
  "url": "https://redis.io/docs/latest/integrate/redis-data-integration/data-pipelines/prepare-dbs/neon/",
  "summary": "Prepare Neon databases to work with RDI",
  "tags": [
    "docs",
    "integrate",
    "rs",
    "rdi"
  ],
  "last_updated": "2026-04-01T08:10:08-05:00",
  "page_type": "content",
  "content_hash": "e676847a52e1472c5c480ec6a4734639fcc6f5a2eb9e1eb09298f1768a86408e",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "[Neon](https://neon.com/) is a serverless PostgreSQL platform. To use Neon as a source database for Redis Data Integration (RDI), you must enable logical replication for the compute endpoint that serves your branch, create a dedicated replication role, grant it the minimum required privileges, and allow inbound network traffic from the RDI connector host.\n\nThe following checklist summarizes the steps to prepare a Neon database for\nRDI, with links to the sections that explain the steps in full detail. You may\nfind it helpful to track your progress with the checklist as you complete each\nstep.\n\n[code example]"
    },
    {
      "id": "1-enable-logical-replication-in-neon",
      "title": "1. Enable logical replication in Neon",
      "role": "content",
      "text": "To capture changes from Neon, the compute endpoint for your branch must have\nlogical replication enabled. This sets the PostgreSQL `wal_level` parameter to\n`logical` for that compute.\n\n1. Sign in to the Neon Console and select the project that hosts the database\n   you want to use with RDI.\n1. On the **Branches** page, choose the branch you want to capture from.\n1. Either create a new compute endpoint for that branch or edit an existing\n   one.\n1. In the compute configuration, enable **Logical replication**.\n1. Save the changes and wait for the compute to restart if required.\n\nAfter the compute is running, connect with a SQL client and confirm that\nlogical replication is enabled by running:\n\n[code example]\n\nThe query should return `logical`.\n\n\nEnabling logical replication increases the volume of write-ahead log (WAL)\ndata that Neon retains. Monitor the project for any impact on storage usage and\ncost."
    },
    {
      "id": "2-create-a-replication-role-for-rdi",
      "title": "2. Create a replication role for RDI",
      "role": "content",
      "text": "It is strongly recommended to create a dedicated database role for the\nconnection that RDI uses, rather than reusing an existing superuser or\napplication role.\n\nConnect to the Neon database as a user with sufficient privileges and create a\nrole similar to the following (replace the identifiers with values that match\nyour environment):\n\n[code example]\n\nThis role:\n\n- can sign in to the database (`LOGIN`)\n- can consume logical replication streams (`REPLICATION`)\n- does not have superuser privileges"
    },
    {
      "id": "3-grant-database-and-table-privileges",
      "title": "3. Grant database and table privileges",
      "role": "content",
      "text": "The replication role must be able to connect to the database, access the\nschemas you want to capture, and read from the tables in those schemas.\n\nRun commands like the following, replacing `mydb` and `rdi_replication` with\nyour database name and replication role:\n\n[code example]\n\nIf you use multiple schemas or need access to sequences, repeat the `GRANT`\nand `ALTER DEFAULT PRIVILEGES` statements for each schema and include\n`SEQUENCES` where appropriate."
    },
    {
      "id": "4-allow-inbound-traffic-to-neon",
      "title": "4. Allow inbound traffic to Neon",
      "role": "content",
      "text": "RDI connects to Neon over the public Internet using the connection string for\nyour compute endpoint. You must ensure that Neon allows inbound traffic from\nthe IP addresses that the RDI connector uses.\n\n1. In the Neon Console, open the project that contains your database.\n1. Go to the **Settings** or **Networking** section for the project and locate\n   the IP allow list or **Allowed IPs** configuration.\n1. Add the public IP address or address range that the RDI connector uses to\n   reach Neon. For production systems, restrict this to the smallest set of\n   IPs possible.\n1. Save the configuration.\n\nFor development or testing, you can temporarily allow access from your own\nclient machine or a broader IP range, but for production environments you\nshould always restrict access to known connector IP addresses.\n\nYou will also need the Neon connection string for use when you configure the\nsource in RDI. In the Neon Console, copy the PostgreSQL connection URI for the\ncompute endpoint you prepared above. It has the form:\n\n[code example]\n\nUse this URI, together with the replication role you created, when you set up\nthe Neon source connection in RDI."
    }
  ],
  "examples": [
    {
      "id": "overview-ex0",
      "language": "checklist {id=\"neonlist\"}",
      "code": "- [ ] [Enable logical replication in Neon](#1-enable-logical-replication-in-neon)\n- [ ] [Create a replication role for RDI](#2-create-a-replication-role-for-rdi)\n- [ ] [Grant database and table privileges](#3-grant-database-and-table-privileges)\n- [ ] [Allow inbound traffic to Neon](#4-allow-inbound-traffic-to-neon)",
      "section_id": "overview"
    },
    {
      "id": "1-enable-logical-replication-in-neon-ex0",
      "language": "sql",
      "code": "SHOW wal_level;",
      "section_id": "1-enable-logical-replication-in-neon"
    },
    {
      "id": "2-create-a-replication-role-for-rdi-ex0",
      "language": "sql",
      "code": "CREATE ROLE rdi_replication\n  WITH LOGIN REPLICATION PASSWORD 'Strong_Password';",
      "section_id": "2-create-a-replication-role-for-rdi"
    },
    {
      "id": "3-grant-database-and-table-privileges-ex0",
      "language": "sql",
      "code": "GRANT CONNECT ON DATABASE mydb TO rdi_replication;\n\nGRANT USAGE ON SCHEMA public TO rdi_replication;\nGRANT SELECT ON ALL TABLES IN SCHEMA public TO rdi_replication;\n\nALTER DEFAULT PRIVILEGES IN SCHEMA public\n  GRANT SELECT ON TABLES TO rdi_replication;",
      "section_id": "3-grant-database-and-table-privileges"
    },
    {
      "id": "4-allow-inbound-traffic-to-neon-ex0",
      "language": "text",
      "code": "postgresql://<user>:<password>@<host>:5432/<database>?sslmode=require",
      "section_id": "4-allow-inbound-traffic-to-neon"
    }
  ]
}
