Skip Navigation
Show nav
Dev Center
  • Get Started
  • Documentation
  • Changelog
  • Search
  • Get Started
    • Node.js
    • Ruby on Rails
    • Ruby
    • Python
    • Java
    • PHP
    • Go
    • Scala
    • Clojure
    • .NET
  • Documentation
  • Changelog
  • More
    Additional Resources
    • Home
    • Elements
    • Products
    • Pricing
    • Careers
    • Help
    • Status
    • Events
    • Podcasts
    • Compliance Center
    Heroku Blog

    Heroku Blog

    Find out what's new with Heroku on our blog.

    Visit Blog
  • Log inorSign up
Hide categories

Categories

  • Heroku Architecture
    • Compute (Dynos)
      • Dyno Management
      • Dyno Concepts
      • Dyno Behavior
      • Dyno Reference
      • Dyno Troubleshooting
    • Stacks (operating system images)
    • Networking & DNS
    • Platform Policies
    • Platform Principles
  • Developer Tools
    • Command Line
    • Heroku VS Code Extension
  • Deployment
    • Deploying with Git
    • Deploying with Docker
    • Deployment Integrations
  • Continuous Delivery & Integration (Heroku Flow)
    • Continuous Integration
  • Language Support
    • Node.js
      • Troubleshooting Node.js Apps
      • Working with Node.js
      • Node.js Behavior in Heroku
    • Ruby
      • Rails Support
      • Working with Bundler
      • Working with Ruby
      • Ruby Behavior in Heroku
      • Troubleshooting Ruby Apps
    • Python
      • Working with Python
      • Background Jobs in Python
      • Python Behavior in Heroku
      • Working with Django
    • Java
      • Java Behavior in Heroku
      • Working with Java
      • Working with Maven
      • Working with Spring Boot
      • Troubleshooting Java Apps
    • PHP
      • Working with PHP
      • PHP Behavior in Heroku
    • Go
      • Go Dependency Management
    • Scala
    • Clojure
    • .NET
      • Working with .NET
  • Databases & Data Management
    • Heroku Postgres
      • Postgres Basics
      • Postgres Getting Started
      • Postgres Performance
      • Postgres Data Transfer & Preservation
      • Postgres Availability
      • Postgres Special Topics
      • Migrating to Heroku Postgres
    • Heroku Key-Value Store
    • Apache Kafka on Heroku
    • Other Data Stores
  • AI
    • Working with AI
    • Heroku Inference
      • Inference API
      • Quick Start Guides
      • Inference Essentials
      • AI Models
    • Vector Database
    • Model Context Protocol
  • Monitoring & Metrics
    • Logging
  • App Performance
  • Add-ons
    • All Add-ons
  • Collaboration
  • Security
    • App Security
    • Identities & Authentication
      • Single Sign-on (SSO)
    • Private Spaces
      • Infrastructure Networking
    • Compliance
  • Heroku Enterprise
    • Enterprise Accounts
    • Enterprise Teams
    • Heroku Connect (Salesforce sync)
      • Heroku Connect Administration
      • Heroku Connect Reference
      • Heroku Connect Troubleshooting
  • Patterns & Best Practices
  • Extending Heroku
    • Platform API
    • App Webhooks
    • Heroku Labs
    • Building Add-ons
      • Add-on Development Tasks
      • Add-on APIs
      • Add-on Guidelines & Requirements
    • Building CLI Plugins
    • Developing Buildpacks
    • Dev Center
  • Accounts & Billing
  • Troubleshooting & Support
  • Integrating with Salesforce
  • Add-ons
  • All Add-ons
  • Redis® Cloud
Redis® Cloud

This add-on is operated by Redis

From the creators of Redis®. Enterprise-Class Redis for Developers (w/Free plan)

Redis® Cloud

Last updated June 18, 2024

Table of Contents

  • Get started
  • Connect to your database
  • Open Redis Cloud console
  • Upgrade plan
  • Remove the add-on
  • Support
  • Additional resources

Redis Cloud is a fully managed cloud service for hosting and running your Redis database. You can quickly and easily get your apps up and running with Redis Cloud through its add-on for Heroku - tell us how much memory you need and get started fast with your first Redis database. You can then add more Redis databases and increase or decrease the memory size of your plan without affecting your existing data.

Redis Cloud offers true high availability with its in-memory dataset replication and instant auto-failover mechanism, combined with its fast storage engine. You can easily import an existing Redis dataset to any of your Redis Cloud databases. For paid plans, we back up your data every 24 hours, and you can back up your data manually at any time.

Get started

Select Install Redis Cloud to install the Redis Cloud add-on.

You can also use the Heroku command-line interface to install Redis Cloud. Run the following heroku command to install the add-on and create a Free 30MB database.

$ heroku addons:create rediscloud

You can also specify the plan size by adding the plan size in MB. For example, run the following command to install the add-on and create a 1GB database.

$ heroku addons:create rediscloud:1000

A list of all available plans can be found here.

After Redis Cloud has been added, you can find a REDISCLOUD_URL config vars in your heroku config containing the username, password, hostname and port of your first Redis Cloud database.

$ heroku config:get REDISCLOUD_URL
http://[username]:[password]@[hostname]:[port]

Connect to your database

You can connect to your database with any Redis client.

The following sections show how to connect with these official, supported, and maintained client libraries:

  • Java with jedis
  • Python with redis-py
  • Node.js with node-redis

See the Redis docs to learn how to connect with the other official client libraries.

You can also connect with these libraries and frameworks:

  • Ruby with redis-rb
  • PHP with Predis
  • Django with django-redis-cache

Connect with Java

jedis is an easy to use Redis Java client. You can download the latest build from github or use it as a maven dependency:

<dependency>
    <groupId>redis.clients</groupId>
    <artifactId>jedis</artifactId>
    <version>2.0.0</version>
    <type>jar</type>
    <scope>compile</scope>
</dependency>

Configure connection to your Redis Cloud service using REDISCLOUD_URLconfig vars and the following code snippet:

try {
        URI redisUri = new URI(System.getenv("REDISCLOUD_URL"));
        JedisPool pool = new JedisPool(new JedisPoolConfig(),
                redisUri.getHost(),
                redisUri.getPort(),
                Protocol.DEFAULT_TIMEOUT,
                redisUri.getUserInfo().split(":",2)[1]);
} catch (URISyntaxException e) {
        // URI couldn't be parsed.
}

Testing (Java)

Jedis jedis = pool.getResource();
jedis.set("foo", "bar");
String value = jedis.get("foo");
// return the instance to the pool when you're done
pool.returnResource(jedis);

A Java sample application, running on Play!, is available at GitHub.
Browse the source code or deploy

Connect with Python

redis-py is the official client to connect to Redis from Python.

Use pip to install it:

sudo pip install redis

Configure connection to your Redis Cloud service using the REDISCLOUD_URLconfig vars and the following code snippet:

import os
import urlparse
import redis
url = urlparse.urlparse(os.environ.get('REDISCLOUD_URL'))
r = redis.Redis(host=url.hostname, port=url.port, password=url.password)

Testing (Python):

>>> r.set('foo', 'bar')
True
>>> r.get('foo')
'bar'

Connect with Node.js

node_redis is a complete Redis client for Node.js.

You can install it with:

npm install redis

Configure connection to your Redis Cloud service using REDISCLOUD_URLconfig vars and the following code snippet:

var redis = require('redis');
var client = redis.createClient(process.env.REDISCLOUD_URL, {no_ready_check: true});

Testing (Node.js)

client.set('foo', 'bar');
client.get('foo', function (err, reply) {
    console.log(reply.toString()); // Will print `bar`
});

A Node.js sample application is available at GitHub.
Browse the source code or deploy

Connect with Ruby

redis-rb is a very stable and mature redis client and the easiest way to access Redis from Ruby.

Install redis-rb:

sudo gem install redis

Configure Redis on Rails

For Rails 2.3.3 up to Rails 3.0, update the config/environment.rb to include the redis gem:

config.gem 'redis'

For Rails 3.0 and above, update the Gemfile:

gem 'redis'

And then install the gem with Bundler:

bundle install

Lastly, create a new redis.rb initializer in config/initializers/ and add the following code snippet. For Rails before version 4:

if ENV["REDISCLOUD_URL"]
    uri = URI.parse(ENV["REDISCLOUD_URL"])
    $redis = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)
end

For Rails 4:

if ENV["REDISCLOUD_URL"]
    $redis = Redis.new(:url => ENV["REDISCLOUD_URL"])
end

Configure Redis on Sinatra

Add this code snippet to your configure block:

configure do
    . . .
    require 'redis'
    uri = URI.parse(ENV["REDISCLOUD_URL"])
    $redis = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)
    . . .
end

Use Redis on Unicorn

No special setup is required when using Redis Cloud with a Unicorn server. Users running Rails apps on Unicorn should follow the instructions in the Configure Redis from Rails section and users running Sinatra apps on Unicorn should follow the instructions in the Configure Redis on Sinatra section.

Testing (Ruby)

$redis.set("foo", "bar")
# => "OK"
$redis.get("foo")
# => "bar"

A Sinatra sample application is available at GitHub.
Browse the source code or deploy

Connect with PHP

Predis is a flexible and feature-complete PHP client library for Redis.

Instructions for installing the Predis library can be found here.

Loading the library to your project should be straightforward:

<?php
// prepend a base path if Predis is not present in your "include_path".
require 'Predis/Autoloader.php';
Predis\Autoloader::register();

Configure connection to your Redis Cloud service using REDISCLOUD_URLconfig vars and the following code snippet:

$redis = new Predis\Client(array(
    'host' => parse_url($_ENV['REDISCLOUD_URL'], PHP_URL_HOST),
    'port' => parse_url($_ENV['REDISCLOUD_URL'], PHP_URL_PORT),
    'password' => parse_url($_ENV['REDISCLOUD_URL'], PHP_URL_PASS),
));

Testing (PHP)

$redis->set('foo', 'bar');
$value = $redis->get('foo');

A PHP sample application is available at GitHub.
Browse the source code or deploy

Configure Redis on Django

Redis can be used as the back-end cache for Django.

To do so, install django-redis-cache:

pip install django-redis-cache

Next, configure your CACHES in the settings.py file:

import os
import urlparse
redis_url = urlparse.urlparse(os.environ.get('REDISCLOUD_URL'))
CACHES = {
        'default': {
            'BACKEND': 'redis_cache.RedisCache',
            'LOCATION': '%s:%s' % (redis_url.hostname, redis_url.port),
            'OPTIONS': {
                'PASSWORD': redis_url.password,
                'DB': 0,
        }
    }
}

Testing (Django)

from django.core.cache import cache
cache.set("foo", "bar")
print cache.get("foo")

A Django sample application is available at GitHub.
Browse the source code or deploy

Open Redis Cloud console

The Redis Cloud console lets you make changes to your database settings, add extra databases to your plan, and view metrics for your databases.

To access the Redis Cloud console, run:

heroku addons:open rediscloud

Alternatively, open the Redis Cloud add-on from your application’s dashboard at heroku.com.

From the Redis Cloud console, you can: - Back up your data and view backups - Add more Redis databases to your plan - View database metrics - Import data from an existing Redis server

Back up your data

By default, Redis stores your backups to a default backup repository. To view your backups from the Redis Cloud console, select your database from the database list. In the Configuration tab, under Durability, select View backups.

View backups button

Select Download to download a backup file.

Download backup button

The default repository only retains daily backups for one week. To learn how to change your backup location, see Back up a database (Redis Cloud docs).

Select Backup now to back up your database manually.

Backup now button

Backups are available only for paid plans.

Add Redis databases to your plan

For paid plans, Redis Cloud allows you to add multiple Redis databases without interfering with your other databases from the Redis Cloud console.

Each plan has a limit for the amount of databases you can create. After you reach the database limit or the memory limit for your plan, you won’t be able to add any more databases.

Your first Redis database is created automatically upon launching the Redis Cloud add-on and its URL and credentials are maintained in REDISCLOUD_URLconfig vars.

To add more databases from the Redis Cloud console:

  1. Select Subscriptions from the menu to see your plan with all of its databases.
  2. Select + Add database to subscription.

    Add database to subscription button

  3. Enter the database name and select your new database’s settings. For more info on these settings, see the Redis Cloud docs.

  4. Select Activate database to activate your new database.

After your new database is ready, select the Connect button to learn how to connect to it.

Connect button

View database metrics

To view metrics from the Redis Cloud console, select your database from the database list, and then select the Metrics tab.

Metrics tab with metrics

For more information on the metrics available in the Redis Cloud console, see Monitor database performance (Redis Cloud docs).

Import data from an existing Redis server

You can create a Redis Cloud instance with the following command:

$ heroku addons:create rediscloud:<plan size> --app <app_name>

You can directly import your data into your Redis Cloud instance by opening the Redis Cloud console and following these steps.

Alternatively, you can migrate your data from your Heroku Data for Redis database to your Redis Cloud Heroku add-on database by using RIOT.

If migrating your data from Heroku Data for Redis, get your Heroku Data for Redis credentials from your config vars in the dashboard or by running the redis:credentials CLI command.

Upgrade plan

Upgrading your plan is easy and instant. It requires no code change and has no effect on your existing datasets. You can use the ‘heroku addons:upgrade’ command to upgrade to a new plan.

$ heroku addons:upgrade rediscloud:[size_in_mb]

For example, run this command to upgrade to a 5 GB database:

$ heroku addons:upgrade rediscloud:5000

Remove the add-on

To remove the Redis Cloud add-on, run:

This will destroy all data and cannot be reversed.

$ heroku addons:destroy rediscloud

Support

All Redis Cloud support and runtime issues should be submitted via the Heroku Support channels. We recommend also reaching out to Redis support for urgent issues. We are also available on twitter @Redisinc.

Additional resources

  • Redis Cloud documentation
  • Develop with Redis docs
  • Redis Client docs

Keep reading

  • All Add-ons

Feedback

Log in to submit feedback.

Zara 4 RedisGreen

Information & Support

  • Getting Started
  • Documentation
  • Changelog
  • Compliance Center
  • Training & Education
  • Blog
  • Support Channels
  • Status

Language Reference

  • Node.js
  • Ruby
  • Java
  • PHP
  • Python
  • Go
  • Scala
  • Clojure
  • .NET

Other Resources

  • Careers
  • Elements
  • Products
  • Pricing
  • RSS
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku Blog
    • Heroku News Blog
    • Heroku Engineering Blog
  • Twitter
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku
    • Heroku Status
  • Github
  • LinkedIn
  • © 2025 Salesforce, Inc. All rights reserved. Various trademarks held by their respective owners. Salesforce Tower, 415 Mission Street, 3rd Floor, San Francisco, CA 94105, United States
  • heroku.com
  • Legal
  • Terms of Service
  • Privacy Information
  • Responsible Disclosure
  • Trust
  • Contact
  • Cookie Preferences
  • Your Privacy Choices