Amazon RDS MySQL

Amazon Relational Database Service (RDS) allows you to deploy scalable MySQL servers in minutes with cost-efficient and resizable hardware capacity.

You can ingest data from your Amazon RDS MySQL database using Hevo Pipelines and replicate it to a Destination of your choice. Hevo recommends connecting to a read-replica of your master MySQL database, however, this is not mandatory. A read-replica reflects the changes to your master database in near real-time, and can reduce the load on the master database by serving all “read” requests. The Role attribute of the instance identifies its type.

Prerequisites


Perform the following steps to configure your Amazon RDS MySQL Source:

Create a Read Replica (Optional)

To use an existing read-replica or connect Hevo to your master database, skip to Set up MySQL Binary Logs for Replication section.

To create a read-replica:

  1. Open the Amazon RDS console.

  2. In the left navigation pane, click Databases (or Instances if you are using an older version).

  3. In the Databases section on the right, click the DB identifier of the RDS MySQL instance you want to replicate. For example, amazon-rds-mysql, in the image below.

    Master DB identifier

  4. In the Actions drop-down, click Create read replica.

    Create Replica drop-down option

  5. Select the instance specifications relevant to your requirements.

    MySQL instance specs

  6. Under Network & Security, ensure that Publicly accessible option is set to Yes to allow connection to the DB instance via a public IP address, such as, Hevo’s IP address.

    Network options

  7. Specify the DB instance identifier, which is the name of the replica instance you are creating, and the Read-replica source and is the instance (master/primary database) being replicated.

    Specify DB instance

  8. Click Create Replica.

    You can now see the Read Replica instance in the Databases page.

    New replica is visible in the list


Set up MySQL Binary Logs for Replication

A binary log is a collection of log files that records information about data modifications and data object modifications made on a MySQL server instance. Typically binary logs are used for data replication and data recovery.

Hevo supports data ingestion for replication the from MySQL database via binary logs (BinLog). For this, binary logging must be enabled on your MySQL instance.

Note: To use binlog replication, your Amazon RDS MySQL database must be running MySQL v5.6 or higher.

To enable binary logging, follow these steps:

1. Configure BinLog format as ROW

  1. Open the Amazon RDS console.

  2. In the left navigation pane, select Databases (or Instances if you are using an older version).

  3. In the Databases section on the right, select the DB instance that you want to connect.

    Select DB Instance

  4. Click the Configuration tab, and then, click the link text under Parameter Group to open its setting page.

    Open Parameter Group Settings

  5. Click Edit parameters.

  6. Update the values of the parameters as follows:

    Parameter Name Value
    binlog_format ROW
    binlog_row_image FULL
    log_slave_updates 1

    Enter Parameter Value

  7. Click Save changes.

  8. In the Databases panel, select Reboot from the Actions drop-down to restart your Amazon RDS MySQL instance for the changes to take effect.

    Restart Instance

The replication reference guide on MySQL’s documentation portal provides a complete reference of the options available for replication and binary logging.

2. Configure the BinLog retention period

  1. Log in to your Amazon RDS MySQL database instance with ADMIN privileges.

  2. Run the following command to view the current BinLog retention period (in hours):

    call mysql.rds_show_configuration;
    

    Note: The BinLog Retention period must be at least 72 hours.

  3. Run the following command to set the retention period to at least 72 hours (three days).

    call mysql.rds_set_configuration('binlog retention hours', 72);
    

Whitelist Hevo’s IP Addresses

You need to whitelist the Hevo IP address for your region to enable Hevo to connect to your Amazon RDS MySQL database. To do this:

  1. Open the Amazon RDS console.

  2. In the left navigation pane, click Databases (or Instances if you are using an older version).

  3. In the Databases section on the right, click the DB identifier of the Amazon RDS MySQL instance to configure a security group.

    Select DB Instance

    Note: The instance does not necessarily have to be a replica as long as it whitelists the region’s IP addresses.

  4. In the Connectivity & security tab:

    Open Security Group Panel

    1. Note the region where your account is set up, as mentioned in the Endpoint or Region & AZ Summary field. Refer to the AWS Regional Endpoints to map this to your Hevo region.

      Note: You can find your region from the Hevo App URL also. For example, the URL for the US region is https://us.hevo.io/.

    2. Click the link text under Security, VPC security groups to open the Security Groups panel.

  5. In the Security Groups panel, click Inbound Rules, and then, Edit Inbound Rules.

    Edit Inbound Rules

  6. In the Edit inbound rules page:

    1. Click Add rule.

    2. In the Port range column, enter the port of your Amazon RDS MySQL instance. For example, 3306.

    3. In the Source column, select Custom from the drop-down and enter Hevo’s IP addresses for your region.

    4. Click Save rules.

      Add Rules

  7. Repeat step 6 in the Outbound Rules tab to configure outbound rules.

    Edit outbound rules


Create a Database User and Grant Privileges

Perform the following steps to grant SELECT and REPLICATION privileges to the database user:

  1. Log into your Amazon RDS MySQL database instance as a user with Grant privilege.

  2. Run the following command to grant SELECT and REPLICATION privileges to the database user:

    GRANT SELECT, REPLICATION CLIENT, REPLICATION SLAVE ON *.* TO <db_user_name>;
    
  3. Grant privileges to the database user to read BinLog settings, if Pipeline mode is Binlog:

    GRANT SELECT ON mysql.rds_configuration to <db_user_name>;
    

Retrieve the Hostname and Port Number (Optional)

Note: The RDS hostnames start with your database name and end with rds.amazonaws.com.
For example:
Host : mysql-rds-replica-1.xxxxxxxxx.rds.amazonaws.com
Port : 3306

  1. In the left navigation pane of the Amazon RDS console, click Databases (or Instances if you are using an older version).

  2. In the Databases section on the right, click the DB identifier of the Amazon RDS MySQL instance.

    Select DB Instance

  3. Click the Connectivity & security tab, and copy the values under Endpoint and Port as the hostname and port number. You will specify these while creating your Hevo Pipeline.

    Endpoint and port number


Specify Amazon RDS MySQL Connection Settings

Specify the following settings in the Configure your Amazon RDS MySQL Source page:

  • Pipeline Name: A unique name for your Pipeline.

  • Database Host: The MySQL host’s IP address or DNS.

    The following table lists a few examples of MySQL host:

    Variant Host
    Amazon RDS MySQL mysql-rds-1.xxxxx.rds.amazonaws.com
    Azure MySQL mysql.database.windows.net
    Generic MySQL 10.123.10.001 or mysql-replica.westeros.inc
    Google Cloud MySQL 35.220.150.0

    Note: For URL-based hostnames, exclude the http:// or https:// part. For example, if the hostname URL is http://mysql-replica.westeros.inc, enter mysql-replica.westeros.inc.

  • Database Port: The port on which your MySQL server is listening for connections. Default value: 3306.

  • Database User: The authenticated user that can read the tables in your database.

  • Database Password: Password for the database user.

  • Database Name: The database you want to load data from, if the Pipeline mode is Table or Custom SQL.

  • Connection Settings

    • Connect through SSH: Enable this option to connect to Hevo using an SSH tunnel, instead of directly connecting your MySQL database host to Hevo. This provides an additional level of security to your database by not exposing your MySQL setup to the public. Read Connecting Through SSH.

      If this option is disabled, you must whitelist Hevo’s IP addresses. Refer to the content for your MySQL variant for steps to do this.

    • Use SSL: Enable it to use SSL encrypted connection. To enable this, specify the following:

      • CA File: The file containing the SSL server certificate authority (CA).

      • Client Certificate: The client public key certificate file.

      • Client Key: The client private key file.

  • Advanced Settings (for Pipelines with BinLog mode)

    • Load All Databases: Applicable for Pipelines with BinLog mode. If this option is enabled, Hevo loads the data from all databases on the selected host. Else, specify a comma-separated list of Database Names you want to load data from.

    • Load Historical Data: Applicable for Pipelines with BinLog mode. If this option is enabled, the entire table data is fetched during the first run of the Pipeline. If disabled, Hevo loads only the data that was written in your database after the time of creation of the Pipeline.

    • Merge Tables: Applicable for Pipelines with BinLog mode. If this option is enabled, Hevo merges tables with the same name from different databases while loading the data to the warehouse. Hevo loads the Database Name field with each record. If disabled, the database name is prefixed to each table name. Read How does the Merge Tables feature work?.

    • Include New Tables in the Pipeline: Applicable for all Pipeline modes except Custom SQL. If enabled, Hevo automatically ingests data from tables created after the Pipeline has been built. If disabled, the new tables are listed in the Pipeline Detailed View in Skipped state, and you can manually include the ones you want and load their historical data.

  • Click TEST & CONTINUE to proceed for setting up the Destination.


Limitations

  • Hevo only fetches tables from the MySQL database. It does not fetch other entities such as functions, stored procedures, views, and triggers.

    To fetch views, you can create individual Pipelines in Custom SQL mode. However, some limitations may arise based on the type of data synchronization, the query mode, or the number of Events. Contact Hevo Support for more details.


Revision History

Refer to the following table for the list of key updates made to this page:

Date Release No. Description of Change
Jul-26-2021 1.68 Added a note for the Database Host field.
Jul-12-2021 NA Added section, Specify Amazon RDS MySQL Connection Settings.
Last updated on 20 Jul 2021