Quick Setup of Redis Enterprise VPC (RV)
The steps for creating a simple Redis Enterprise VPC (RV) deployment are as follows:
- Sign up for an RV account
- Create a dedicated AWS account/User for RV
- Create a new RV subscription
- Create a new database definition
- Connect to your database
Step 1 - Sign up for Redis Enterprise VPC account
Step 2 - Create an AWS account for RV to use
RV requires a dedicated AWS account to perform operations on your behalf. Inside of that account, create an AWS user in IAM specifically for RV use, per "Creating an AWS user for Redis Enterprise VPC."
Step 3 - Create a new RV subscription
Add a new subscription to your account, if you do not already have one. If you do have an existing RV subscription, then proceed to Step 4.
For a new subscription, you will need to provide the following:
- A subscription name
- The cloud region in which you want your databases to be created
- Whether you want to use Redis on Flash or pure RAM Redis database
- The Cloud Account to be used. Use the AWS user created above in Step #2 for setting up your RV Cloud Account
- Please provide the required Deployment CIDR - this is an IPv4 subnet with /24 subnet mask, in CIDR notation, that you would like RV to use. For a standard deployment, you can specify 10.0.1.0/24. Later on, you will have to create a VPC peering link to your application, therefore, please make sure that the CIDR you provide does not conflict with your application VPC CIDR.
Once your selections are made, click Continue to finalize your subscription. RV 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:
- Database name
- 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 replication and a data persistence policy for your database, then enter the quantity of databases to create multiple databases on your RV subscription with the provided settings.
Once selections are made, save the settings entered row by clicking on the Add button. You can add more rows by clicking on the plus button.
Once done with all databases, click on Continue.
Behind the scenes, RV 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
Note: Plan creation may take a little time base on a few factors, e.g. your inputs, AWS response times, etc.
Once planning is complete, please review the presented subscription and database information. Either select Free Trial or provide a payment method by selecting an existing one or click on the + button to add a new one.
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 - 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 22.214.171.124... Connected to redis-19836.c9.us-east-1-2.ec2.cloud.redislabs.com. Escape character is '^]'. AUTH my_redis_password PING +PONG
Note: We recommend loading the redis-cli command-line utility for future use as you will use it for other things.
$ 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 import redis # Create connection object r = redis.Redis(host='pub-redis-10382.us-west-2-1.1.ec2.garantiadata.com', port=10382) # set a value for the foo object r.set('foo', 'bar') # retrieve and print the value for the foo object print(r.get('foo'))
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.