|  | 
|  | 1 | +--- | 
|  | 2 | +Title: RDI on Redis Cloud quick start | 
|  | 3 | +linkTitle: Quick start | 
|  | 4 | +alwaysopen: false | 
|  | 5 | +categories: | 
|  | 6 | +- docs | 
|  | 7 | +- operate | 
|  | 8 | +- rc | 
|  | 9 | +description: Learn how to create a data pipeline between a PostgreSQL source database created with Terraform and a Redis Cloud target database. | 
|  | 10 | +hideListLinks: true | 
|  | 11 | +weight: 1 | 
|  | 12 | +--- | 
|  | 13 | + | 
|  | 14 | +The [`rdi-cloud-automation` GitHub repository](https://github.com/redis/rdi-cloud-automation) 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. | 
|  | 15 | + | 
|  | 16 | +{{< note >}} | 
|  | 17 | +This guide is for demonstration purposes only. It is not recommended for production use. | 
|  | 18 | +{{< /note >}} | 
|  | 19 | + | 
|  | 20 | +## Prerequisites | 
|  | 21 | + | 
|  | 22 | +To follow this guide, you need to: | 
|  | 23 | + | 
|  | 24 | +1. Create a [Redis Cloud Pro database]({{< relref "/operate/rc/databases/create-database/create-pro-database-new" >}}) hosted on Amazon Web Services (AWS). | 
|  | 25 | + | 
|  | 26 | + Turn on Multi-AZ replication and [manually select the availability zones]({{< relref "/operate/rc/databases/configuration/high-availability#availability-zones" >}}) when creating the database. | 
|  | 27 | + | 
|  | 28 | +1. Install the [AWS CLI](https://aws.amazon.com/cli/) and set up [credentials for the CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html). | 
|  | 29 | + | 
|  | 30 | +1. Install [Terraform](https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli). | 
|  | 31 | + | 
|  | 32 | +## Create a data pipeline | 
|  | 33 | + | 
|  | 34 | +1. On the [Redis Cloud console](https://cloud.redis.io/), go to your target database and select the **Data Pipeline** tab. | 
|  | 35 | +1. Select **Create pipeline**. | 
|  | 36 | + {{<image filename="images/rc/rdi/rdi-create-data-pipeline.png" alt="The create pipeline button." width=200px >}} | 
|  | 37 | +1. Select **PostgreSQL** as the source database type. | 
|  | 38 | + {{<image filename="images/rc/rdi/rdi-select-source-db.png" alt="The select source database type list." width=500px >}} | 
|  | 39 | +1. Under **Setup connectivity**, save the provided ARN and extract the AWS account ID for the account associated with your Redis Cloud cluster from it.  | 
|  | 40 | + | 
|  | 41 | + {{<image filename="images/rc/rdi/rdi-setup-connectivity-arn.png" alt="The select source database type list." width=80% >}} | 
|  | 42 | + | 
|  | 43 | + 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`. | 
|  | 44 | + | 
|  | 45 | +## Create the source database and network resources | 
|  | 46 | + | 
|  | 47 | +1. Clone or download the [`rdi-cloud-automation` GitHub repository](https://github.com/redis/rdi-cloud-automation). | 
|  | 48 | + | 
|  | 49 | +1. In a terminal window, go to the `examples` directory. | 
|  | 50 | + | 
|  | 51 | +1. Run `terraform init` to initialize the Terraform working directory. | 
|  | 52 | + | 
|  | 53 | +1. Open the `example.tfvars` file and edit the following variables: | 
|  | 54 | + | 
|  | 55 | + - `region`: The AWS region where your Redis Cloud database is deployed. | 
|  | 56 | + - `azs`: The availability zone IDs where your Redis Cloud database is deployed. | 
|  | 57 | + - `port`: The port number for the new PostgreSQL source database. | 
|  | 58 | + - `name`: A prefix for all of the created AWS resources. | 
|  | 59 | + - `redis-account`: The AWS account ID for your Redis Cloud cluster you saved earlier. | 
|  | 60 | + | 
|  | 61 | +1. To view the configuration, run: | 
|  | 62 | + | 
|  | 63 | + ```sh | 
|  | 64 | + terraform plan -var-file=example.tfvars | 
|  | 65 | + ``` | 
|  | 66 | + | 
|  | 67 | +1. To create the AWS resources, run: | 
|  | 68 | + | 
|  | 69 | + ```sh | 
|  | 70 | + terraform apply -var-file=example.tfvars | 
|  | 71 | + ``` | 
|  | 72 | + | 
|  | 73 | + This example creates the following resources on your AWS account: | 
|  | 74 | + | 
|  | 75 | + - An AWS KMS key with the required permissions for RDI | 
|  | 76 | + - A VPC with a public and private subnet and all necessary route tables | 
|  | 77 | + - An EC2 instance running a PostgreSQL database with a security group that allows access from Redis Cloud | 
|  | 78 | + - An AWS Secrets Manager secret for the PostgreSQL database credentials | 
|  | 79 | + - A Network Load Balancer (NLB), a listener, and target group to route traffic to the EC2 instance with AWS PrivateLink | 
|  | 80 | + - An AWS PrivateLink endpoint service for the PostgreSQL database | 
|  | 81 | + | 
|  | 82 | +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. | 
|  | 83 | +
 | 
|  | 84 | +Save the following outputs: | 
|  | 85 | +
 | 
|  | 86 | +- `database`: The name of the PostgreSQL database. | 
|  | 87 | +- `port`: The port number for the PostgreSQL database. | 
|  | 88 | +- `secret_arn`: The ARN of the AWS Secrets Manager secret for the PostgreSQL database credentials. | 
|  | 89 | +- `vpc_endpoint_service_name`: The name of the AWS PrivateLink endpoint service for the PostgreSQL database. | 
|  | 90 | +
 | 
|  | 91 | +If you lose any outputs, run `terraform output` to view them again. | 
|  | 92 | +
 | 
|  | 93 | +## Define source connection | 
|  | 94 | +
 | 
|  | 95 | +1. Return to the [Redis Cloud console](https://cloud.redis.io/). Go to your target database and select the **Data Pipeline** tab. | 
|  | 96 | +1. Select **Define source database**. | 
|  | 97 | + {{<image filename="images/rc/rdi/rdi-define-source-database.png" alt="The define source database button." width=200px >}} | 
|  | 98 | +1. Enter a **Pipeline name**.  | 
|  | 99 | + {{<image filename="images/rc/rdi/rdi-define-pipeline-cidr.png" alt="The pipeline name and deployment CIDR fields." >}} | 
|  | 100 | +1. A **Deployment CIDR** is automatically generated for you. If, for any reason, a CIDR is not generated, enter a valid CIDR that does not conflict with your applications or other databases. | 
|  | 101 | +1. Enter the terraform outputs in the following fields: | 
|  | 102 | + - **PrivateLink service name**: `vpc_endpoint_service_name` | 
|  | 103 | + - **Database**: `database` | 
|  | 104 | + - **Port**: `port` | 
|  | 105 | + - **Source database secrets ARN**: `secret_arn` | 
|  | 106 | +1. Select **Start pipeline setup**. | 
|  | 107 | + {{<image filename="images/rc/rdi/rdi-start-pipeline-setup.png" alt="The start pipeline setup button." width=200px >}} | 
|  | 108 | +
 | 
|  | 109 | +At this point, Redis Cloud will provision the pipeline infrastructure that will allow you to define your data pipeline.  | 
|  | 110 | +
 | 
|  | 111 | +{{<image filename="images/rc/rdi/rdi-pipeline-setup-in-progress.png" alt="The Pipeline setup in progress screen." width=75% >}} | 
|  | 112 | +
 | 
|  | 113 | +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. | 
|  | 114 | + | 
|  | 115 | +When your pipeline is provisioned, select **Complete setup**. | 
|  | 116 | + | 
|  | 117 | +{{<image filename="images/rc/rdi/rdi-complete-setup.png" alt="The complete setup button." width=200px >}} | 
|  | 118 | + | 
|  | 119 | +## Define data pipeline | 
|  | 120 | + | 
|  | 121 | +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. | 
|  | 122 | + | 
|  | 123 | +See [Define data pipeline]({{<relref "/operate/rc/databases/rdi/define#define-data-pipeline">}}) for detailed steps on defining your data pipeline. | 
|  | 124 | + | 
|  | 125 | +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.  | 
|  | 126 | + | 
|  | 127 | +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. | 
|  | 128 | + | 
|  | 129 | +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. | 
|  | 130 | + | 
|  | 131 | +## Delete sample resources | 
|  | 132 | + | 
|  | 133 | +{{< warning >}} | 
|  | 134 | +Make sure to [delete your data pipeline]({{<relref "/operate/rc/databases/rdi/view-edit#delete-pipeline">}}) before deleting the sample resources. | 
|  | 135 | +{{< /warning >}} | 
|  | 136 | + | 
|  | 137 | +To delete the sample resources created by Terraform, run: | 
|  | 138 | + | 
|  | 139 | +```sh | 
|  | 140 | +terraform destroy -var-file=example.tfvars | 
|  | 141 | +``` | 
0 commit comments