content/operate/rc/databases/rdi/quick-start.md
The rdi-cloud-automation GitHub repository contains a Terraform script that quickly sets up a PostgreSQL source database on an EC2 instance and all required permissions and network setup to connect it to a Redis Cloud target database.
{{< note >}} This guide is for demonstration purposes only. It is not recommended for production use. {{< /note >}}
To follow this guide, you need to:
Create a [Redis Cloud Pro database]({{< relref "/operate/rc/databases/create-database/create-pro-database-new" >}}) hosted on Amazon Web Services (AWS).
Turn on Multi-AZ replication and [manually select the availability zones]({{< relref "/operate/rc/databases/configuration/high-availability#availability-zones" >}}) when creating the database.
Install the AWS CLI and set up credentials for the CLI.
Install Terraform.
On 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 PostgreSQL as the source database type. {{<image filename="images/rc/rdi/rdi-select-source-db.png" alt="The select source database type list." width=500px >}}
Under Source database credentials and certificates, save the provided ARN. This will be the redis_secrets_arn you will need later.
{{<image filename="images/rc/rdi/rdi-credentials-arn.png" alt="The setup connectivity section containing the credentials ARN." width=80% >}}
Under Setup connectivity, save the provided ARN. This will be the redis_privatelink_arn you will need later.
{{<image filename="images/rc/rdi/rdi-setup-connectivity-arn.png" alt="The setup connectivity section containing the private link ARN." width=80% >}}
Clone or download the rdi-cloud-automation GitHub repository.
In a terminal window, go to the examples/aws-ec2-privatelink directory.
Run terraform init to initialize the Terraform working directory.
Open the example.tfvars file and edit the following variables:
region: The AWS region where your Redis Cloud database is deployed.azs: The availability zone IDs where your Redis Cloud database is deployed.port: The port number for the new PostgreSQL source database.name: A prefix for all of the created AWS resources.redis_secrets_arn: The source database credentials and certificates ARN from the Redis Cloud console.redis_privatelink_arn: The PrivateLink ARN from the Redis Cloud console.To view the configuration, run:
terraform plan -var-file=example.tfvars
To create the AWS resources, run:
terraform apply -var-file=example.tfvars
This example creates the following resources on your AWS account:
Creating the AWS resources will take some time. After the resources are created, you'll be able to view them in the AWS management console.
Save the following outputs:
database: The name of the PostgreSQL database.port: The port number for the PostgreSQL database.secret_arn: The ARN of the AWS Secrets Manager secret for the PostgreSQL database credentials.vpc_endpoint_service_name: The name of the AWS PrivateLink endpoint service for the PostgreSQL database.If you lose any outputs, run terraform output to view them again.
vpc_endpoint_service_namedatabaseportsecret_arnAt this point, Redis Cloud will provision the pipeline infrastructure that will allow you to define your data pipeline.
{{<image filename="images/rc/rdi/rdi-pipeline-setup-in-progress.png" alt="The Pipeline setup in progress screen." width=75% >}}
Pipelines are provisioned in the background. You aren't allowed to make changes to your data pipeline or to your database during provisioning. This process will take about an hour, so you can close the window and come back later.
When your pipeline is provisioned, select Complete setup.
{{<image filename="images/rc/rdi/rdi-complete-setup.png" alt="The complete setup button." width=200px >}}
After your pipeline is provisioned, you will be able to define your pipeline. You will select the database schemas, tables, and columns that you want to import and synchronize with your primary database.
See [Define data pipeline]({{<relref "/operate/rc/databases/rdi/define#define-data-pipeline">}}) for detailed steps on defining your data pipeline.
After you define your data pipeline, it will ingest data from the source database to your target Redis database. This process will take time, especially if you have a lot of records in your source database.
After this initial sync is complete, the data pipeline enters the change streaming phase, where changes are captured as they happen. Changes in the source database are added to the target within a few seconds of capture. You can see this by connecting to your source database and making changes to the data, and then connecting to your target Redis database and verifying that the changes are reflected there.
You can view the status of your data pipeline in the Data pipeline tab of your database. See [View and edit data pipeline]({{<relref "/operate/rc/databases/rdi/view-edit">}}) to learn more.
{{< warning >}} Make sure to [delete your data pipeline]({{<relref "/operate/rc/databases/rdi/view-edit#delete-pipeline">}}) before deleting the sample resources. {{< /warning >}}
To delete the sample resources created by Terraform, run:
terraform destroy -var-file=example.tfvars