content/operate/rc/databases/rdi/setup.md
In the Redis Cloud console, go to your target database and select the Data Pipeline tab.
Select Create pipeline. {{<image filename="images/rc/rdi/rdi-create-data-pipeline.png" alt="The create pipeline button." width=200px >}}
Select your source database type. The following database types are supported:
If you know the size of your source database, enter it into the Source dataset size field. {{<image filename="images/rc/rdi/rdi-source-dataset-size.png" alt="Enter the amount of source data you plan to ingest." width=400px >}}
Under Setup connectivity, save the provided ARN and extract the AWS account ID for the account associated with your Redis Cloud cluster from it.
{{<image filename="images/rc/rdi/rdi-setup-connectivity-arn.png" alt="The select source database type list." width=80% >}}
The AWS account ID is the string of numbers after arn:aws:iam:: in the ARN. For example, if the ARN is arn:aws:iam::123456789012:role/redis-data-pipeline, the AWS account ID is 123456789012.
Before using the pipeline, you must first prepare your source database to use the Debezium connector for change data capture (CDC). See [Prerequisites]({{<relref "/operate/rc/databases/rdi#prerequisites">}}) to find a list of supported source databases and database versions.
See [Prepare source databases]({{<relref "/integrate/redis-data-integration/data-pipelines/prepare-dbs/">}}) to find steps for your database type:
See the [RDI architecture overview]({{< relref "/integrate/redis-data-integration/architecture#overview" >}}) for more information about CDC.
To ensure that you can connect your Redis Cloud database to the source database, you need to set up an endpoint service through AWS PrivateLink.
The following diagrams show the network setup for the different database setups:
Database hosted on an AWS EC2 instance:
{{<image filename="images/rc/rdi/rdi-setup-diagram-ec2.png" alt="The network setup for a database hosted on an AWS EC2 instance." width=80% >}}
Database hosted on AWS RDS or AWS Aurora:
{{<image filename="images/rc/rdi/rdi-setup-diagram-aurora.png" alt="The network setup for a database hosted on AWS RDS or AWS Aurora." width=80% >}}
Select the steps for your database setup.
{{< multitabs id="rdi-cloud-connectivity" tab1="EC2 instance" tab2="AWS RDS or Aurora" >}}
To set up PrivateLink for a database hosted on an EC2 instance:
In the AWS Management Console, use the Services menu to locate and select Compute > EC2. Create a network load balancer with the following settings:
In Basic configuration:
In Network mapping, select the VPC and availability zone associated with your source database.
In Security groups, select the security group associated with your source database, or another security group that allows traffic from PrivateLink and allows traffic to the database.
In Listeners and routing:
Review the network load balancer settings, and then select Create load balancer to continue.
After the network load balancer is active, select Security.
If you selected the same security group as your source database, you must not enforce security group rules on PrivateLink traffic. Select Edit and then deselect Enforce inbound rules on PrivateLink traffic, and then select Save changes.
Select the security group ID to open the Security group settings.
Select Edit inbound rules, then Add rule to add a rule with the following settings:
Select Actions > Edit Load Balancer Attributes.
In the AWS Management Console, use the Services menu to locate and select Networking & Content Delivery > VPC. There, select PrivateLink and Lattice > Endpoint services. Create an endpoint service with the following settings:
After you create the endpoint service, you need to add Redis Cloud as an Allowed Principal on your endpoint service VPC permissions.
For more details on AWS PrivateLink, see Share your services through AWS PrivateLink.
--tab-sep--
To set up PrivateLink for a database hosted on AWS RDS or AWS Aurora:
To connect to your RDS or Aurora database, we recommend using a Lambda function approach. This provides a reliable and secure connection method for all database types.
{{<note>}} If you have specific requirements that necessitate using RDS Proxy instead of the recommended Lambda function approach, see the [RDS Proxy setup guide]({{< relref "/operate/rc/databases/rdi/rds-proxy" >}}). Note that RDS Proxy is not recommended and does not work with PostgreSQL. {{</note>}}
In the AWS Management Console, use the Services menu to locate and select Compute > EC2. Create a network load balancer with the following settings:
In Basic configuration:
In Network mapping, select the VPC and availability zone associated with your source database.
In Security groups, select the security group associated with your source database, or another security group that allows traffic from PrivateLink and allows traffic to the database.
In Listeners and routing:
In Specify group details:
In Register targets, enter the static IP address of your database, enter the port, and select Include as pending below. Then, select Create target group to create your target group. Return to Listeners and routing in the Network Load Balancer setup.
To get the static IP address of your database, run the following command on an EC2 instance in the same VPC as the database:
$ nslookup <database-endpoint>
Replace <database-endpoint> with the endpoint of your RDS or Aurora database.
Review the network load balancer settings, and then select Create load balancer to continue.
After the network load balancer is active, select Security.
If you selected the same security group as your source database, you must not enforce security group rules on PrivateLink traffic. Select Edit and then deselect Enforce inbound rules on PrivateLink traffic, and then select Save changes.
Select the security group ID to open the Security group settings.
Select Edit inbound rules, then Add rule to add a rule with the following settings:
Select Actions > Edit Load Balancer Attributes.
In the AWS Management Console, use the Services menu to locate and select Networking & Content Delivery > VPC. There, select PrivateLink and Lattice > Endpoint services. Create an endpoint service with the following settings:
After you create the endpoint service, you need to add Redis Cloud as an Allowed Principal on your endpoint service VPC permissions.
For more details on AWS PrivateLink, see Share your services through AWS PrivateLink.
{{<note>}} Setting up the Lambda function is optional but recommended for production environments. The Lambda function provides automatic failover handling and a more robust connection to your RDS or Aurora database. {{</note>}}
The Lambda function monitors RDS failover events and automatically updates the NLB Target Group to point to the new primary instance's IP address. This ensures RDI reconnects automatically after a failover.
Redis provides a ready-to-use Terraform module that automates the Lambda function deployment. This is the recommended approach.
Before deploying the Lambda module, gather the following information:
| Variable | Description | Where to find it |
|---|---|---|
identifier | A unique name for the Lambda resources | Choose a descriptive name (e.g., rdi-failover-handler) |
db_endpoint | Your RDS cluster or instance endpoint | AWS Console → RDS → Your database → Connectivity |
db_port | Your database port | AWS Console → RDS → Your database → Connectivity (default: 5432 for PostgreSQL, 3306 for MySQL, 1433 for SQL Server) |
elb_tg_arn | The NLB Target Group ARN | AWS Console → EC2 → Target Groups → Your target group |
rds_arn | The RDS cluster or instance ARN | AWS Console → RDS → Your database → Configuration |
rds_cluster_identifier | The RDS cluster identifier | AWS Console → RDS → Your cluster name |
Clone the Redis cloud automation repository:
git clone https://github.com/redis/rdi-cloud-automation.git
cd rdi-cloud-automation/modules/aws-rds-lambda
Create a terraform.tfvars file with your configuration:
identifier = "rdi-failover-handler"
db_endpoint = "your-cluster.cluster-xxxxxxxxx.us-east-1.rds.amazonaws.com"
db_port = 5432
elb_tg_arn = "arn:aws:elasticloadbalancing:us-east-1:123456789012:targetgroup/your-tg/xxxxxxxxx"
rds_arn = "arn:aws:rds:us-east-1:123456789012:cluster:your-cluster"
rds_cluster_identifier = "your-cluster"
Initialize and apply Terraform:
terraform init
terraform apply
The deployed Lambda function:
This process typically completes within 30-60 seconds for Aurora, or 60-120 seconds for standard RDS.
After deployment, verify the Lambda function is configured correctly:
Cluster_EndPoint: Your RDS endpointRDS_Port: Your database portNLB_TG_ARN: Your NLB Target Group ARNFor new deployments, Redis provides a complete Terraform example that deploys the entire infrastructure including the RDS database, NLB, PrivateLink, and Lambda function.
See the AWS RDS PrivateLink Failover Example for:
For custom implementations, refer to the AWS documentation: Access Amazon RDS across VPCs using AWS PrivateLink and Network Load Balancer
{{< /multitabs >}}
You need to share your source database credentials and certificates in an Amazon secret with Redis Cloud so that the pipeline can connect to your database.
To do this, you need to:
In the AWS Management Console, use the Services menu to locate and select Security, Identity, and Compliance > Key Management Service. Create an encryption key with the following settings:
Review the key policy and key settings, and then select Finish to create the key.
To let Redis Cloud access your source database, you need to create AWS secrets for the source database's credentials and certificates.
The required secrets depend on your source database's security configuration. The following table shows the required secrets for each configuration:
| Security configuration | Required secrets |
|---|---|
| Username and password only | <ul><li>Credentials secret (username and password for the RDI pipeline user)</li></ul> |
| TLS connection | <ul><li>Credentials secret (username and password for the RDI pipeline user)</li><li>CA Certificate secret (server certificate)</li></ul> |
| mTLS connection | <ul><li>Credentials secret (username and password for the RDI pipeline user)</li><li>CA Certificate secret (server certificate)</li><li>Client certificate secret</li><li>Client key secret</li></ul> |
| mTLS connection with client key passphrase | <ul><li>Credentials secret (username and password for the RDI pipeline user)</li><li>CA Certificate secret (server certificate)</li><li>Client certificate secret</li><li>Client key secret</li><li>Client key passphrase secret</li></ul> |
Select a tab to learn how to create the required secret.
{{< multitabs id="rdi-cloud-secrets" tab1="Credentials secret" tab2="CA Certificate secret" tab3="Client certificate secret" tab4="Client key secret" tab5="Client key passphrase secret" >}}
In the AWS Management Console, use the Services menu to locate and select Security, Identity, and Compliance > Secrets Manager. Create a secret of type Other type of secret with the following settings:
Key/value pairs: Enter the following key/value pairs.
username: Database username for the RDI pipeline userpassword: Database password for the RDI pipeline user{{< embed-md "rc-rdi-secrets-encryption-permissions.md" >}}
--tab-sep--
In the AWS Management Console, use the Services menu to locate and select Security, Identity, and Compliance > Secrets Manager. Create a secret of type Other type of secret with the following settings:
{{< embed-md "rc-rdi-secrets-encryption-permissions.md" >}}
--tab-sep--
In the AWS Management Console, use the Services menu to locate and select Security, Identity, and Compliance > Secrets Manager. Create a secret of type Other type of secret with the following settings:
{{< embed-md "rc-rdi-secrets-encryption-permissions.md" >}}
--tab-sep--
Use the AWS CLI create-secret command or the AWS CreateSecret API endpoint to create a binary secret containing the client key.
For example, using the AWS CLI, run the following command:
aws secretsmanager create-secret \
--name <secret-name> \
--secret-binary fileb://<path-to-client-key> \
--kms-key-id <encryption-key-arn>
Where:
<secret-name> - Name of the secret<path-to-client-key> - Path to the client key file<encryption-key-arn> - ARN of the encryption key you created earlierAfter you create the secret, you need to add permissions to allow the data pipeline to access it.
In the AWS Management Console, use the Services menu to locate and select Security, Identity, and Compliance > Secrets Manager. Select the private key secret you just created and then select Edit permissions.
Add the following permissions to your secret. Replace <AWS ACCOUNT ID> with the AWS account ID for the Redis Cloud cluster that you saved earlier.
{{< embed-md "rc-rdi-secrets-permissions.md" >}}
--tab-sep--
In the AWS Management Console, use the Services menu to locate and select Security, Identity, and Compliance > Secrets Manager. Create a secret of type Other type of secret with the following settings:
{{< embed-md "rc-rdi-secrets-encryption-permissions.md" >}}
{{< /multitabs >}}
After you have set up your source database and prepared connectivity and credentials, select Define source database to [define your source connection and data pipeline]({{<relref "/operate/rc/databases/rdi/define">}}).
{{<image filename="images/rc/rdi/rdi-define-source-database.png" alt="The define source database button." width=200px >}}