Skip to content

Redis Cloud Integration

  1. Navigate to Integrations in your team settings
  2. Click Connect on the Redis Cloud integration
  3. Choose your identity provider (Google or GitHub)
  4. You’ll be redirected to Redis Cloud to authorize FastAPI Cloud
  5. Grant the requested permissions and you’ll be redirected back

After connecting your Redis Cloud account, you can link a database to any app in your team:

  1. Go to your app’s Storage tab in the app details
  2. Select the Redis Cloud integration
  3. Choose an existing subscription and database, or create a new free database
  4. Optionally trigger an immediate redeployment

The database must be in an active status to be connected.

If you don’t have a Redis Cloud database yet, you can create one directly from FastAPI Cloud:

  1. Click Create free database during the connection flow
  2. Enter a name and select a region
  3. FastAPI Cloud will create a free-tier subscription and database in your Redis Cloud account
  4. Once the database is ready, connect it to your app

The default environment variable name is REDIS_URL. You can customize this when connecting (e.g., REDIS_CLOUD_URL if you already have a REDIS_URL in use).

Here’s an example of how to use your Redis Cloud connection automatically available via the REDIS_URL environment variable:

cache.py
import redis.asyncio as redis
import os
# The Redis URL is automatically injected as an environment variable
REDIS_URL = os.getenv("REDIS_URL")
async def get_redis_client():
return redis.from_url(REDIS_URL)
async def cache_example():
client = await get_redis_client()
await client.set("key", "value")
value = await client.get("key")
await client.set("cache:data", "cached_value", ex=timedelta(minutes=10))
# Clean up
await client.close()