Skip to main content

Connect Your Client

Upstash works with Redis® API, that means you can use any Redis client with Upstash. At the Redis Clients page you can find the list of Redis clients in different languages.

Probably, the easiest way to connect to your database is to use redis-cli. Because it is already covered in Getting Started, we will skip it here.


After completing the getting started guide, you will see the database page as below:

The information required for Redis clients is displayed here as Endpoint, Port and Password. Also when you click on Connect button, you can copy the code that is required for your client.

Below we will give examples from popular Redis clients, but the above information should help you to configure all Redis clients similarly.


If you have enabled TLS in your database, please refer to Connect With TLS section instead.


Library: node redis


var redis = require('redis');
var host = 'YOUR_ENDPOINT';var port = 'YOUR_PORT';var password = 'YOUR_PASSWORD';
var client = redis.createClient ({    port : port,    host : host,    password: password});
client.on("error", function(err) {    throw err;  });
client.set('foo','bar');client.get('foo', function(err, response){    if(err) {        throw err;        }    else {        console.log(response);        client.quit();    }});


Library: redis-py


import redisr = redis.Redis(host= 'YOUR_ENDPOINT',port= 'YOUR_PORT',password= 'YOUR_PASSWORD')r.set('foo','bar')print(r.get('foo'))


Library: jedis


Jedis jedis = new Jedis("YOUR_ENDPOINT", "YOUR_PORT");jedis.auth("YOUR_PASSWORD");jedis.set("foo", "bar");String value = jedis.get("foo");System.out.println(value);


Library: redigo


func main() {  c, err := redis.Dial("tcp", "YOUR_ENDPOINT:YOUR_PORT")  if err != nil {      panic(err)  }
  _, err = c.Do("AUTH", "YOUR_PASSWORD")  if err != nil {      panic(err)  }
  _, err = c.Do("SET", "foo", "bar")  if err != nil {      panic(err)  }
  value, err := redis.String(c.Do("GET", "foo"))  if err != nil {      panic(err)  }