Redis
You can now add Redis to a stack. Alien creates a Redis-compatible server on a private network in your customer's cloud, and your code connects with the client it already uses: ioredis, node-redis, redis-py, or BullMQ.
const cache = new alien.Redis("cache")
.memory("4Gi")
.evictionPolicy("allkeys-lru")
.build()
const api = new alien.Container("api")
.code({ type: "image", image: "ghcr.io/acme/api:1.4.0" })
.link(cache)
.permissions("execution")
.build()
export default new alien.Stack("acme")
.add(cache, "frozen")
.add(api, "live")
.permissions({ profiles: { execution: { cache: ["redis/data-access"] } } })
.build()import { redis } from "@alienplatform/sdk"
import { Redis } from "ioredis"
const conn = await redis("cache").connection()
const client = new Redis({
host: conn.host,
port: conn.port,
username: conn.username,
password: conn.password,
tls: conn.tls || undefined,
})The server has no public endpoint, and TLS and a password are always on.
connection() reads the password with the workload's own identity, so it
never sits in an environment variable.
| Platform | Server |
|---|---|
| AWS | ElastiCache for Valkey |
| Google Cloud | Memorystore for Valkey, through Private Service Connect |
| Azure | Azure Managed Redis, through a private endpoint |
| Kubernetes, Machines | A server the customer provides, through an external binding |
alien dev | Valkey in Docker |
- Options: memory, eviction policy, persistence, a replica in another zone with automatic failover, and a customer-managed encryption key
- One endpoint: Lua scripts,
MULTI/EXEC, streams, pub/sub, and blocking commands work as on a plain Redis server - Python and Rust: the same
connection(), and in Pythonredis.Redis(**conn.redis_kwargs())