Quick Setup of Redis Cloud Pro
When you create a Redis Cloud subscription, you must choose:
- A cloud provider: Amazon AWS, Microsoft Azure, Google Cloud Platform
- The provider region
- Redis Cloud service level:
- Essentials - For development environments and low-throughput applications
- Pro - For high-throughput applications, many databases or large datasets
- Ultimate - For a more complete support experience (Contact Redis Labs Sales)
Step 1: Create a New Subscription
To create a new subscription:
- In the Redis Cloud menu, click Subscriptions.
- At the bottom of the page, click .
- Select your subscription configuration:
- Select a cloud provider: Amazon AWS, Microsoft Azure, Google Cloud Platform
- Select the region that you want the subscription to use, for example:
- In the Redis Cloud service levels, select the memory or throughput limit for your subscription.
- After you select a subscription configuration:
- Review the subscription configuration.
- Enter the IP range for the subscription in Deployment CIDR.
- Enter your Credit card information.
- Enter a name for the subscription.
The cluster for your selected subscription is created. You can change the name and credit card information of the subscription after it is created.
The subscription shows a "Pending" status and takes approximately 10 to 15 minutes to provision. You receive an email when your subscription is ready to use.
We recommend that you setup VPC peering with your application VPC. VPC peering lets you route traffic between your VPCs using private IP addresses for improved security and performance.
You can also edit these subscription settings after the subscription is created:
- Subscription name
- Payment information
Step 2: Create a Database
After you create a subscription, you can create a database:
- Enter a name for the database.
- Select the protocol (Redis or Memcached).
- Review the databases settings.
- Click Activate.
The database is in "Pending" status. When the database is created, you can see the database settings, including:
- Endpoint - The address you use to connect to the database
- Redis Password - The password you must use in your application connections to authenticate with the database
To add more databases:
- Go to Databases.
- Click on your subscription in the list of subscriptions.
- Click and enter the databases settings.
Step 3: Connect to your database
Now you can connect to the database with telnet, redis-cli, or an application.
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 18.104.22.168... 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.
After you test 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, you change the host, port, password and SSL certificates in any existing code or apps that use Redis and you are done.