Skip to content

Redis Cloud Integration

  1. Navigate to Integrations in your team sidebar
Team Integrations page with Connect buttons for Logfire, Neon, Redis Cloud, and Supabase. Team Integrations page with Connect buttons for Logfire, Neon, Redis Cloud, and Supabase.
  1. Click Connect on the Redis Cloud integration
  2. Choose your identity provider (Google or GitHub)
  3. You’ll be redirected to Redis Cloud to authorize FastAPI Cloud
  4. 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 Integrations tab in the app details and click Connect Integration
App Integrations page with no connected integrations and the Connect Integration button. App Integrations page with no connected integrations and the Connect Integration button.
  1. Click Select on the Redis Cloud integration
Add Integration dialog with the Redis Cloud account connected and its Select button available.
Add Integration dialog with the Redis Cloud account connected and its Select button available.
  1. Choose an existing subscription, or create a new free database
Redis Cloud subscription selection with two active subscriptions.
Redis Cloud subscription selection with two active subscriptions.
  1. Choose a database. This step is skipped for Essentials subscriptions
Redis Cloud database selection with two active databases.
Redis Cloud database selection with two active databases.
  1. Review the selected database and environment variable, then connect it. You can optionally trigger an immediate redeployment
Redis Cloud confirmation dialog with the selected database, environment variable, and Connect and Redeploy button.
Redis Cloud confirmation dialog with the selected database, environment variable, and Connect and Redeploy button.

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

If your Redis Cloud account has no Essentials subscription, you can create a free database directly from FastAPI Cloud:

  1. Click Create Free Database during the connection flow
Redis Cloud dialog with no subscriptions found and the Create Free Database button.
Redis Cloud dialog with no subscriptions found and the Create Free Database button.
  1. Enter a name and select a region
  2. FastAPI Cloud will create a free-tier subscription and database in your Redis Cloud account
  3. 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()