> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-fbfa8bee.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Step-by-step guide on how to set up Amazon RDS MariaDB as a source for ClickPipes

# RDS MariaDB source setup guide

export const Image = ({img, alt, size}) => {
  return <Frame>
      <img src={img} alt={alt} />
    </Frame>;
};

This is a step-by-step guide on how to configure your RDS MariaDB instance for replicating its data via the MySQL ClickPipe.

<br />

<Info>
  We also recommend going through the MySQL FAQs [here](/integrations/clickpipes/mysql/faq). The FAQs page is being actively updated.
</Info>

<h2 id="enable-binlog-retention-rds">
  Enable binary log retention
</h2>

The binary log is a set of log files that contain information about data modifications made to a MySQL server instance. Binary log files are required for replication. Both of the steps below must be followed:

<h3 id="enable-binlog-logging-rds">
  1. Enable binary logging via automated backup
</h3>

The automated backups feature determines whether binary logging is turned on or off for MySQL. It can be set in the AWS console:

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-fbfa8bee/2Zeerd64Tl5ZAQUa/images/integrations/data-ingestion/clickpipes/mysql/source/rds/rds-backups.png?fit=max&auto=format&n=2Zeerd64Tl5ZAQUa&q=85&s=44d50884f8b3249b79019ebd1447aba1" alt="Enabling automated backups in RDS" size="lg" border width="3230" height="530" data-path="images/integrations/data-ingestion/clickpipes/mysql/source/rds/rds-backups.png" />

Setting backup retention to a reasonably long value depending on the replication use-case is advisable.

<h3 id="binlog-retention-hours-rds">
  2. Binlog retention hours
</h3>

Amazon RDS for MariaDB has a different method of setting binlog retention duration, which is the amount of time a binlog file containing changes is kept. If some changes aren't read before the binlog file is removed, replication will be unable to continue. The default value of binlog retention hours is NULL, which means binary logs aren't retained.

To specify the number of hours to retain binary logs on a DB instance, use the mysql.rds\_set\_configuration function with a binlog retention period long enough for replication to occur. `24 hours` is the recommended minimum.

```text theme={null}
mysql=> call mysql.rds_set_configuration('binlog retention hours', 24);
```

<h2 id="binlog-parameter-group-rds">
  Configure binlog settings in the parameter group
</h2>

The parameter group can be found when you click on your MariaDB instance in the RDS Console, and then navigate to the `Configurations` tab.

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-fbfa8bee/2Zeerd64Tl5ZAQUa/images/integrations/data-ingestion/clickpipes/mysql/parameter_group/rds_config.png?fit=max&auto=format&n=2Zeerd64Tl5ZAQUa&q=85&s=766ea15966c79142865d34124370f656" alt="Where to find parameter group in RDS" size="lg" border width="708" height="853" data-path="images/integrations/data-ingestion/clickpipes/mysql/parameter_group/rds_config.png" />

Upon clicking on the parameter group link, you will be taken to the parameter group link page. You will see an Edit button in the top-right:

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-fbfa8bee/2Zeerd64Tl5ZAQUa/images/integrations/data-ingestion/clickpipes/mysql/parameter_group/edit_button.png?fit=max&auto=format&n=2Zeerd64Tl5ZAQUa&q=85&s=db811f938ad7abca9ace78dc8ef0d93f" alt="Edit parameter group" size="lg" border width="1662" height="292" data-path="images/integrations/data-ingestion/clickpipes/mysql/parameter_group/edit_button.png" />

Settings `binlog_format`, `binlog_row_metadata` and `binlog_row_image` need to be set as follows:

1. `binlog_format` to `ROW`.

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-fbfa8bee/2Zeerd64Tl5ZAQUa/images/integrations/data-ingestion/clickpipes/mysql/parameter_group/binlog_format.png?fit=max&auto=format&n=2Zeerd64Tl5ZAQUa&q=85&s=3ab86fae4861bc5fcf9128a81fd0f127" alt="Binlog format to ROW" size="lg" border width="960" height="232" data-path="images/integrations/data-ingestion/clickpipes/mysql/parameter_group/binlog_format.png" />

2. `binlog_row_metadata` to `FULL`

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-fbfa8bee/2Zeerd64Tl5ZAQUa/images/integrations/data-ingestion/clickpipes/mysql/parameter_group/binlog_row_metadata.png?fit=max&auto=format&n=2Zeerd64Tl5ZAQUa&q=85&s=92f964698139fb7ab9714a3ee20f476b" alt="Binlog row metadata to FULL" size="lg" border width="934" height="234" data-path="images/integrations/data-ingestion/clickpipes/mysql/parameter_group/binlog_row_metadata.png" />

3. `binlog_row_image` to `FULL`

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-fbfa8bee/2Zeerd64Tl5ZAQUa/images/integrations/data-ingestion/clickpipes/mysql/parameter_group/binlog_row_image.png?fit=max&auto=format&n=2Zeerd64Tl5ZAQUa&q=85&s=5528c5fc8f50bdb26880979cc842116f" alt="Binlog row image to FULL" size="lg" border width="934" height="234" data-path="images/integrations/data-ingestion/clickpipes/mysql/parameter_group/binlog_row_image.png" />

Next, click on `Save Changes` in the top-right. You may need to reboot your instance for the changes to take effect. If you see `Pending reboot` next to the parameter group link in the Configurations tab of the RDS instance, this is a good indication that a reboot of your instance is needed.

<br />

<Tip>
  If you have a MariaDB cluster, the above parameters would be found in a [DB Cluster](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_WorkingWithParamGroups.CreatingCluster.html) parameter group and not the DB instance group.
</Tip>

<h2 id="gtid-mode-rds">
  Enabling GTID Mode
</h2>

Global Transaction Identifiers (GTIDs) are unique IDs assigned to each committed transaction in MySQL/MariaDB. They simplify binlog replication and make troubleshooting more straightforward. MariaDB enables GTID mode by default, so no user action is needed to use it.

<h2 id="configure-database-user-rds">
  Configure a database user
</h2>

Connect to your RDS MariaDB instance as an admin user and execute the following commands:

1. Create a dedicated user for ClickPipes:

   ```sql theme={null}
   CREATE USER 'clickpipes_user'@'host' IDENTIFIED BY 'some-password';
   ```

2. Grant schema permissions. The following example shows permissions for the `mysql` database. Repeat these commands for each database and host that you want to replicate:

   ```sql theme={null}
   GRANT SELECT ON `mysql`.* TO 'clickpipes_user'@'host';
   ```

3. Grant replication permissions to the user:

   ```sql theme={null}
   GRANT REPLICATION CLIENT ON *.* TO 'clickpipes_user'@'%';
   GRANT REPLICATION SLAVE ON *.* TO 'clickpipes_user'@'%';
   ```

<h2 id="configure-network-access">
  Configure network access
</h2>

<h3 id="ip-based-access-control">
  IP-based access control
</h3>

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

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-fbfa8bee/2Zeerd64Tl5ZAQUa/images/integrations/data-ingestion/clickpipes/mysql/source/rds/security-group-in-rds-mysql.png?fit=max&auto=format&n=2Zeerd64Tl5ZAQUa&q=85&s=6207ee2b4575226d22be83a3c7d21847" alt="Where to find security group in RDS?" size="lg" border width="2850" height="994" data-path="images/integrations/data-ingestion/clickpipes/mysql/source/rds/security-group-in-rds-mysql.png" />

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-fbfa8bee/kkh98eOd_iRyUp1R/images/integrations/data-ingestion/clickpipes/postgres/source/rds/edit_inbound_rules.png?fit=max&auto=format&n=kkh98eOd_iRyUp1R&q=85&s=baa7c5ba8889b33e5222949fbd5bd469" alt="Edit inbound rules for the above security group" size="lg" border width="1800" height="935" data-path="images/integrations/data-ingestion/clickpipes/postgres/source/rds/edit_inbound_rules.png" />

<h3 id="private-access-via-aws-privatelink">
  Private access via AWS PrivateLink
</h3>

To connect to your RDS instance through a private network, you can use AWS PrivateLink. Follow our [AWS PrivateLink setup guide for ClickPipes](/resources/support-center/knowledge-base/cloud-services/aws-privatelink-setup-for-clickpipes) to set up the connection.
