title_wip

[Edit this page](https://github.com/ClickHouse/clickhouse-docs/blob/main/docs/integrations/data-ingestion/clickpipes/postgres/source/aurora.md)

## Supported Postgres versions[​](#supported-postgres-versions "Direct link to Supported Postgres versions")

ClickPipes supports Aurora PostgreSQL-Compatible Edition version 12 and later.

## Enable logical replication[​](#enable-logical-replication "Direct link to Enable logical replication")

You can skip this section if your Aurora instance already has the following settings configured:

- `rds.logical_replication = 1`
- `wal_sender_timeout = 0`

These settings are typically pre-configured if you previously used another data replication tool.

```
postgres=> SHOW rds.logical_replication ;
 rds.logical_replication
-------------------------
 on
(1 row)

postgres=> SHOW wal_sender_timeout ;
 wal_sender_timeout
--------------------
 0
(1 row)
```

If not already configured, follow these steps:

1. Create a new parameter group for your Aurora PostgreSQL version with the required settings:
   - Set `rds.logical_replication` to 1
   - Set `wal_sender_timeout` to 0

2. Apply the new parameter group to your Aurora PostgreSQL cluster

3. Reboot your Aurora cluster to apply the changes

## Configure database user[​](#configure-database-user "Direct link to Configure database user")

Connect to your Aurora PostgreSQL writer instance as an admin user and execute the following commands:

1. Create a dedicated user for ClickPipes:

   ```
   CREATE USER clickpipes_user PASSWORD 'some-password';
   ```
2. Grant schema-level, read-only access to the user you created in the previous step. The following example shows permissions for the `public` schema. Repeat these commands for each schema containing tables you want to replicate:

   ```
   GRANT USAGE ON SCHEMA "public" TO clickpipes_user;
   GRANT SELECT ON ALL TABLES IN SCHEMA "public" TO clickpipes_user;
   ALTER DEFAULT PRIVILEGES IN SCHEMA "public" GRANT SELECT ON TABLES TO clickpipes_user;
   ```
3. Grant replication privileges to the user:

   ```
   GRANT rds_replication TO clickpipes_user;
   ```
4. Create a [publication](https://www.postgresql.org/docs/current/logical-replication-publication.html) with the tables you want to replicate. We strongly recommend only including the tables you need in the publication to avoid performance overhead.

   Note

   Any table included in the publication must either have a **primary key** defined *or* have its **replica identity** configured to `FULL`. See the [Postgres FAQs](/docs/integrations/clickpipes/postgres/faq#how-should-i-scope-my-publications-when-setting-up-replication) for guidance on scoping.

   - To create a publication for specific tables:

     ```
     CREATE PUBLICATION clickpipes FOR TABLE table_to_replicate, table_to_replicate2;
     ```
   - To create a publication for all tables in a specific schema:

     ```
     CREATE PUBLICATION clickpipes FOR TABLES IN SCHEMA "public";
     ```

   The `clickpipes` publication will contain the set of change events generated from the specified tables, and will later be used to ingest the replication stream.

## Configure network access[​](#configure-network-access "Direct link to Configure network access")

### IP-based access control[​](#ip-based-access-control "Direct link to IP-based access control")

If you want to restrict traffic to your Aurora cluster, please add the [documented static NAT IPs](/docs/integrations/clickpipes#list-of-static-ips) to the `Inbound rules` of your Aurora security group.

### Private access via AWS PrivateLink[​](#private-access-via-aws-privatelink "Direct link to Private access via AWS PrivateLink")

To connect to your Aurora cluster through a private network, you can use AWS PrivateLink. Follow our [AWS PrivateLink setup guide for ClickPipes](/docs/knowledgebase/aws-privatelink-setup-for-clickpipes) to set up the connection.

### Aurora-specific considerations[​](#aurora-specific-considerations "Direct link to Aurora-specific considerations")

When setting up ClickPipes with Aurora PostgreSQL, keep these considerations in mind:

1. **Connection Endpoint**: Always connect to the writer endpoint of your Aurora cluster, as logical replication requires write access to create replication slots and must connect to the primary instance.
2. **Failover Handling**: In the event of a failover, Aurora will automatically promote a reader to be the new writer. ClickPipes will detect the disconnection and attempt to reconnect to the writer endpoint, which will now point to the new primary instance.
3. **Global Database**: If you're using Aurora Global Database, you should connect to the primary region's writer endpoint, as cross-region replication already handles data movement between regions.
4. **Storage Considerations**: Aurora's storage layer is shared across all instances in a cluster, which can provide better performance for logical replication compared to standard RDS.

### Dealing with dynamic cluster endpoints[​](#dealing-with-dynamic-cluster-endpoints "Direct link to Dealing with dynamic cluster endpoints")

While Aurora provides stable endpoints that automatically route to the appropriate instance, here are some additional approaches for ensuring consistent connectivity:

1. For high-availability setups, configure your application to use the Aurora writer endpoint, which automatically points to the current primary instance.
2. If using cross-region replication, consider setting up separate ClickPipes for each region to reduce latency and improve fault tolerance.

## What's next?[​](#whats-next "Direct link to What's next?")

You can now [create your ClickPipe](/docs/integrations/clickpipes/postgres) and start ingesting data from your Aurora PostgreSQL cluster into ClickHouse Cloud.
Make sure to note down the connection details you used while setting up your Aurora PostgreSQL cluster as you will need them during the ClickPipe creation process.

- [Supported Postgres versions](#supported-postgres-versions)- [Enable logical replication](#enable-logical-replication)- [Configure database user](#configure-database-user)- [Configure network access](#configure-network-access)
        - [IP-based access control](#ip-based-access-control)- [Private access via AWS PrivateLink](#private-access-via-aws-privatelink)- [Aurora-specific considerations](#aurora-specific-considerations)- [Dealing with dynamic cluster endpoints](#dealing-with-dynamic-cluster-endpoints)- [What's next?](#whats-next)

Was this page helpful?