Browse docs
Cloud docs
Connecting to Redis on Layerbase Cloud
Redis instances expose the Redis protocol for standard clients and an HTTP-compatible path for edge runtimes.
Best for: Caching, queues, rate limits, session stores, and apps that already use Redis client libraries.
Open your database in the dashboard
Go to /cloud, click the database you just created, and the connection panel shows the host, port, username, password, and a ready-to-paste connection string for the engine.
Use the generated password from Quick Connect. The username is usually default unless the dashboard shows otherwise.
TLS is required, on by default
Use rediss:// URLs or enable TLS in your Redis client.
Redis protocol over TLS on port 6379
Use any standard client
Redis works with the normal client family for that engine. Start with the dashboard snippet, then move the same URL and credentials into your app environment.
If your client has separate direct, pooled, TLS, or HTTP options, prefer the exact variant shown in Quick Connect.
redis-cli -u "rediss://default:password@your-host.cloud.layerbase.dev:6379" pingTLS SNI is required on port 6379
Every Redis and Valkey database on Layerbase Cloud answers on the same shared port 6379. The router picks your database from the TLS SNI hostname in the handshake, not from the port.
Node.js clients do not send an SNI hostname when you pass a bare rediss:// URL, because Node only sends SNI when the TLS servername is set explicitly. With ioredis the handshake fails with ECONNRESET ("Client network socket disconnected before secure TLS connection was established"); with node-redis it hangs, then times out. It looks like a firewall or credential problem, but it is not: set the TLS servername to your database host and it connects.
This also applies to libraries built on these clients, such as BullMQ (ioredis under the hood): pass the same tls servername through their connection options. openssl s_client and redis-cli with --sni succeed against the same endpoint because they do send SNI, which is a quick way to confirm the endpoint itself is healthy.
import { createClient } from 'redis'
const client = createClient({
username: 'default',
password: process.env.REDIS_PASSWORD,
socket: {
host: 'your-host.cloud.layerbase.dev',
port: 6379,
tls: true,
// Required: routing on port 6379 uses the TLS SNI hostname.
servername: 'your-host.cloud.layerbase.dev',
},
})
await client.connect()import Redis from 'ioredis'
// A bare rediss:// URL fails with ECONNRESET: routing on port 6379
// needs the TLS SNI hostname, and ioredis only sends it when the
// tls servername is set explicitly.
const client = new Redis(
'rediss://default:password@your-host.cloud.layerbase.dev:6379',
{ tls: { servername: 'your-host.cloud.layerbase.dev' } },
)Redis notes
- Use the REST endpoint when your runtime cannot open raw TCP sockets.
- Redis licensing means some deployments may prefer Valkey for long-term open-source compatibility.