Valkey
A Valkey resource provisions a managed Valkey key-value store inside your pod. Valkey is Redis-compatible, so any app or library that supports Redis can connect to it. Use it for caching, session storage, queues, or any workload that benefits from fast in-memory data access.
How Valkey Works
When you create a Valkey resource, Brainpod runs a Valkey instance inside your pod and exposes it at a stable hostname-the resource name you chose. The store is only accessible from within your pod; it is not reachable from the internet.
Valkey stores its data on a Disk resource that you attach at creation time. This means the data survives restarts using append-only file persistence. The Disk is managed separately and persists even if you delete the Valkey resource.
Connections to Valkey are always encrypted with TLS and require password authentication. Brainpod generates and manages the password automatically.
Configuring a Valkey
Valkey has four fields:
- Name: A unique identifier within your pod. Use descriptive names like
cacheorsessions. - Instance: The compute size for your store. Since Valkey is in-memory, the instance size directly affects available memory:
.5x,1x,2x,4x, or8x. - Version: The Valkey version. Currently, version 9 is supported.
- Disk: The Disk resource used for persistence. You must create a Disk first and reference it here. This field cannot be changed after creation.
The instance size can be changed later if you need more memory. The version and disk reference are immutable.
Connecting to Valkey
Apps connect to Valkey using environment variables. When you reference a Valkey resource in an app's environment, Brainpod automatically makes the following variables available:
| Variable | Description |
|---|---|
${name.host} |
Hostname of the Valkey instance |
${name.port} |
Port (6379) |
${name.password} |
Generated password (injected securely) |
${name.uri} |
Full connection string |
Replace name with the name of your Valkey resource. The connection string uses the rediss:// scheme (Redis over TLS):
rediss://:<password>@<name>:6379
In your app's environment variable configuration, you would set it up like this:
- Name:
REDIS_URL - Value:
${cache.uri}(wherecacheis your Valkey resource name)
Use the CLI
Inspect the schema and exported variables before creating the resource:
brainpod describe resource valkey --json
brainpod --pod my-pod resource variables valkey cache
Open a temporary tunnel for valkey-cli, redis-cli, or another local client:
brainpod --pod my-pod tunnel cache 127.0.0.1:16379
Keep the command running and use the credentials and connection details it prints. The API key requires database:connect; name resolution and credential retrieval also require resources:read. See Database tunnels for session and security behavior.
Next Steps
- Apps: Connect your app to a Valkey store
- Disks: Create a disk for your Valkey instance to use
- Database tunnels: Connect a local Valkey client
- Resources: Overview of Brainpod resources