Quick Setup of Redise Cloud Private (RCP)
The steps for creating a simple Redise Cloud Private (RCP) deployment are as follows:
- Sign up for an RCP account
- Create a dedicated AWS account for RCP
- Create a new RCP subscription
- Create a new database definition
- Set up Amazon Virtual Private Cloud (VPC) Peering
- Connect to your database
Step #1 – Sign up for Redise Cloud Private account
Step #2 – Create an AWS account for RCP to use
RCP requires a dedicated AWS account to perform operations in your VPC on your behalf. Inside of that account, create an AWS user in IAM specifically for Redise Cloud Private use, per “Creating an AWS user for Redise Cloud Private.”
Step #3 – Create a new RCP subscription
Add a new subscription to your account, if you do not already have one. If you do have an existing RCP subscription, then proceed to Step 4.
For a new subscription, you will need to provide the following:
- A subscription name
- The cloud region you want your databases to be created in AWS
- The AWS user created above in Step #2. For this user, please supply the following details:
- AWS_ACCESS_KEY_ID – RCP user’s AWS access key
- AWS_SECRET_ACCESS_KEY – RCP user’s AWS secret key
- AWS Console User – RCP AWS console user
- AWS Console password – RCP console user’s password
- IAM Users sign-in link – This is the link you use to log into the AWS console (e.g. https://ACCOUNT-ID-WITHOUT-HYPENS.signin.aws.amazon.com/console)
- Please provide the required Deployment CIDR – this is an IPv4 subnet, in CIDR notation, that you would like RCP to use. For a minimal three node deployment, you can specify 10.0.1.0/27.
Once your selections are made, click “Continue” to finalize your subscription. RCP will authenticate the credentials with AWS, then proceed to the next step.
Step #4 – Create the database definition
Next, define the databases to provision. Each row in the table represents a group of databases that share the same specification.
To start with a single database, provide the following details:
- Dataset size – The estimated size of your data. You can specify 1GB for a small database.
- Throughput – The estimated total throughput you expect from your database. You can specify 10,000 ops/sec to start with a small deployment.
Optionally, you can specify a data persistence policy for your database and enter the quantity of databases to create multiple databases on your RCP subscription with the provided settings.
Once selections are made, save the entered row by clicking on the save button. You can add more rows by clicking on the plus button.
Once done with all databases, click on “Continue“.
Behind the scenes, RCP is performing a few operations based on your inputs:
- Calculating the necessary resources
- Crafting a plan for an optimized cloud infrastructure based on those calculations
Once planning is complete, please review the presented subscription and database information. Either select an existing payment method or click on the “+” button to add a new payment method.
Select the “Continue” button to create the subscription and deploy the database(s). The subscription will display a “Pending” status and may take ten to fifteen minutes to construct the infrastructure using the generated optimization plan. You will receive an email once your databases are ready to use.
Step #5 – Setup Amazon Virtual Private Cloud (VPC) peering
In order for your application to be able to connect to your newly created databases, you must first create VPC peering between your application and the new RCP VPCs.
To find out your RCP VPC details, go to Subscriptions in the menu and then click on the relevant subscription name. Use that information to set up the VPC Peering.
You can refer to the AWS Documentation to guide you through the process.
Once the peering was established please define the relevant routing groups on your application account and RCP account.
Step #6 – Connect to your database
Using the menu, navigate to the Databases page. Select one of the databases and select the Configuration tab and look for the database endpoint.
As a quick smoke test, telnet to your assigned endpoint and port. Then enter the Redis PING command. You should see something like this:
# telnet redis-19836.c9.us-east-1-2.ec2.cloud.redislabs.com 19836 Trying 126.96.36.199... Connected to redis-19836.c9.us-east-1-2.ec2.cloud.redislabs.com. Escape character is '^]'. AUTH my_redis_password PING +PONG
$ redis-cli -h redis-19836.c9.us-east-1-2.ec2.cloud.redislabs.com \ -p 19836 -a astrongpassword redis-19836.c9.us-east-1-2.ec2.cloud.redislabs.com:19836> PING PONG
You can get redis-cli and other command-line Redis tools through your favorite package manager or by installing Redis locally.
Once you have tested the connection to your Redis database, you can start reading and writing data. The following code snippet writes the value bar to the Redis key “foo”, reads it back, and then prints it. This snippet is written in Python, but you can use your favorite language (for examples in other languages, go here).
You first need to install the Redis client library for Python if you do not have it already.
$ sudo pip install redis
Next copy and paste this into a file named “example_redis.py“:
#import the library
# Create connection object
r = redis.Redis(
# set a value for the foo object
# retrieve and print the value for the foo object
Now run the code:
$ python example_redis.py bar
With that simple test complete, if you have existing code or an app that uses Redis, just change the host, port, password and SSL certificates and you are done.