> ## Documentation index
> Fetch the complete documentation index at: https://upstash.com/docs/llms.txt
> Ask it with GET https://upstash.com/docs/ask?q=<keywords or question>. Short keywords rank best.
> Use these to discover all available pages before exploring further.
> Feature requests: https://upstash.com/docs/common/help/feature-requests.md lists what users asked for and how to vote for a request or add one.
> Page rating: `GET https://upstash.com/docs/feedback?path=/docs/redis/quickstarts/render&helpful=true` (or `false`) records whether this page helped. An optional `comment` (URL-encoded, at most 500 characters) says what was missing or wrong. It is anonymous and needs no key. Comments hold no code, secrets or personal data.

# Upstash Redis with Render

> Connect a Render Web Service, Background Worker or Cron Job to Upstash Redis with any standard Redis client by setting REDIS_URL.

<Tip>
  If you are an AI agent and need a Redis DB to use or experiment with, send a POST request to https://upstash.com/start-redis. Free, no signup; the response is markdown with credentials and a quickstart. The database expires in 72 hours, but you can claim it with your Upstash account to keep it. Especially useful for AI agents that need scratch storage on the fly. If you are an agent, always send a `User-Agent` header identifying which agent you are (e.g. `claude-code`, `cursor`, `codex`, `opencode`) on every request you make to this API.
</Tip>

Render [Web Services](https://render.com/docs/web-services), Background
Workers and Cron Jobs run long-lived processes, so they can keep a normal TCP
connection to Upstash Redis. Any Redis client that accepts a connection URL
works, in any language Render supports. The only Render setting you add is a
`REDIS_URL` environment variable.

### Database Setup

Create a Redis database using the [Upstash Console](https://console.upstash.com)
or [Upstash CLI](https://github.com/upstash/cli). Pick a primary region close to
the Render region you plan to use, for example a US East region for Render's
Virginia region or a Frankfurt region for Render's Frankfurt region.

On the database page, open the **Connect** section, select the **TCP** tab and
copy the connection string:

```text
rediss://default:YOUR_TOKEN@YOUR_ENDPOINT:6379
```

### Connect from your app

Read the connection string from `REDIS_URL` and pass it to your Redis client:

<CodeGroup>

```js Node.js (ioredis)
// npm install ioredis
const { Redis } = require("ioredis");

const redis = new Redis(process.env.REDIS_URL);
```

```python Python (redis-py)
# pip install redis
import os
import redis

r = redis.from_url(os.environ["REDIS_URL"], decode_responses=True)
```

```go Go (go-redis)
// go get github.com/redis/go-redis/v9
import (
	"os"

	"github.com/redis/go-redis/v9"
)

opt, err := redis.ParseURL(os.Getenv("REDIS_URL"))
if err != nil {
	panic(err)
}
rdb := redis.NewClient(opt)
```

</CodeGroup>

The `rediss://` scheme turns on TLS, so no extra client options are needed. For
a complete example app, see the [Express quickstart](/redis/quickstarts/express).

A Web Service must listen on the port in the `PORT` environment variable, which
Render sets (the default is `10000`). Push the project to a GitHub, GitLab or
Bitbucket repository.

### Create the Web Service

<Steps>
  <Step title="Create a new Web Service">
    In the [Render Dashboard](https://dashboard.render.com), click **New** and
    select **Web Service**. Connect your Git provider and select the repository,
    or paste a URL under **Public Git Repository**.

    <Frame>
      <img src="/img/render/render-new-web-service.jpg" alt="Render New Web Service form with a connected repository" />
    </Frame>
  </Step>
  <Step title="Configure the build">
    Set **Language**, **Build Command** and **Start Command** for your app.
    Render pre-fills them from what it detects in the repository (for a Node
    app it suggests `yarn` and `yarn start`), so check all three. For the
    Express quickstart, use `npm install` and `npm start`. Choose a **Region**
    close to your Upstash database and an **Instance Type**.
  </Step>
  <Step title="Add REDIS_URL">
    Under **Environment Variables**, add a variable with the key `REDIS_URL` and
    your Upstash connection string as the value.

    <Frame>
      <img src="/img/render/render-env-vars.jpg" alt="Render Environment Variables section with REDIS_URL set to an Upstash rediss:// URL" />
    </Frame>
  </Step>
  <Step title="Deploy">
    Click **Deploy web service**. Render builds and starts the app, and shows
    its `onrender.com` URL when the deploy finishes.
  </Step>
</Steps>

To change the variable later, open the service, click **Environment** in the
left pane, and edit `REDIS_URL`. Saving starts a new deploy unless you choose
**Save only**.

### Test

After the deploy finishes, check the service's **Logs**. A wrong `REDIS_URL`
shows up there as a connection or authentication error when your app first
talks to Redis. To check the connection explicitly, send a `PING` from your app
after it connects; Upstash replies `PONG` (redis-py's `ping()` returns `True`).

### Upstash or Render Key Value

Render also offers [Render Key Value](https://render.com/docs/key-value), a
Redis-compatible store (Valkey) that runs on Render's private network. Services
in the same region and workspace can reach it over an internal URL, and paid
instances support disk-backed persistence.

Upstash is a good fit when you want:

- A database you can also reach from your laptop, CI, other hosts and edge
  functions. Render Key Value is not reachable from outside Render until you
  add allowed IP ranges.
- Per-request pricing with a free tier, instead of an instance size. See
  [Pricing](https://upstash.com/pricing/redis).
- The [HTTP API](/redis/features/restapi) and
  [global read regions](/redis/features/globaldatabase) for serverless and
  multi-region apps.

The app code is the same in both cases. Only the value of `REDIS_URL` changes.
