Managed Redis
Run the engine's Redis on Memorystore with high availability, TLS and AUTH instead of the in-cluster Redis.
On this page
The engine uses Redis for sign-in sessions, rate-limit counters and a short-lived execution status cache. Postgres is the source of truth: Redis never holds message or step data, and every key can be rebuilt. By default the Helm chart runs one Redis pod in the cluster, with a password and a NetworkPolicy that lets only the engine and Medplum connect.
Switch to Memorystore for Redis when you want Redis to survive a zone outage or want Google to patch it. Terraform creates the instance, and the chart turns its own Redis off and connects to Memorystore instead.
flowchart LR
subgraph YOURS["Your Google Cloud project"]
direction TB
ENG["Engine and Medplum\non private GKE"]
MS[("Memorystore for Redis\nSTANDARD_HA")]
SM["Secret Manager\nredis-auth"]
ENG == "TLS (rediss://) + AUTH\nprivate service access" ==> MS
SM -. "deploy reads the AUTH string" .-> ENG
endWhat Terraform sets up
| Setting | Value |
|---|---|
| Tier | STANDARD_HA: a replica in another zone with automatic failover |
| In-transit encryption | On (server authentication). Clients must use TLS. |
| AUTH | On. The AUTH string is stored as <secret_prefix>-redis-auth. |
| Network | Private service access on the module's VPC. No public endpoint. |
| Encryption at rest | Google-managed keys, or your key when cmek_kms_key is set. |
| Eviction | allkeys-lru, like the in-cluster Redis |
| Maintenance | Sundays from 08:00 UTC |
Only the deploy service account can read the AUTH secret, through a grant on that secret. Memorystore adds no project-level IAM, and the engine's service account gets no Memorystore permissions: it only speaks the Redis protocol.
How the engine connects
The deploy passes the chart three things: the instance address, the server CA certificates, and the AUTH string. The engine then gets:
| Variable | Value |
|---|---|
REDIS_URL | rediss://<host>:6378. No password in the URL. |
REDIS_PASSWORD | The AUTH string, from the chart Secret. |
REDIS_TLS_CA_FILE | The mounted server CA. Memorystore uses its own CA, not a public one. |
Medplum gets the same address, AUTH string and CA. The chart refuses to render an external Redis without a host or without AUTH, and if REDIS_TLS_CA_FILE is set while REDIS_URL is not rediss://, the engine does not connect to Redis at all and /api/ready fails, instead of falling back to plaintext.
Steps
1. Turn it on
In terraform.tfvars:
redis = "memorystore"
memorystore_tier = "STANDARD_HA" # or BASIC: one node, no failover
memorystore_memory_size_gb = 1
memorystore_private_range_cidr = "10.252.0.0/24" # must not overlap your other ranges2. Apply, then deploy
cd terraform/gke
terraform apply
terraform output -raw memorystore_instanceThen run a normal deploy (Upgrade and roll back). It reads the AUTH string from Secret Manager and the address and CA from the Terraform values.
3. Check the connection
Open Settings → Overview in the engine. The Redis row of the Engine block shows the Memorystore address, and /api/ready returns ready only when Redis answers.
If /api/ready answers 503 with redis not ok, the engine cannot reach or sign in to Memorystore. Check that REDIS_URL is rediss:// on port 6378, that REDIS_TLS_CA_FILE points at the mounted CA, and that the AUTH string in the chart Secret matches the current version of <secret_prefix>-redis-auth. Then deploy again. The engine never falls back to plaintext.
Checklist
-
redis = "memorystore"is applied, andmemorystore_private_range_cidroverlaps none of your other ranges. - The switch happened in a maintenance window, and people knew they would sign in again.
- Settings → Overview shows the Memorystore address, and
/api/readyis ready on every engine pod.
Using another managed Redis
Outside Terraform, set the chart values yourself:
externalRedis:
enabled: true
host: redis.example.test
port: 6378
caCert: |
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
auth:
existingSecret: redis-auth # or password: in your secrets values file
existingSecretKey: auth-stringLeave caCert empty when the server certificate chains to a public CA.
Reference
| Variable | Default | What it sets |
|---|---|---|
redis | in-cluster | in-cluster or memorystore. |
memorystore_tier | STANDARD_HA | STANDARD_HA or BASIC. |
memorystore_memory_size_gb | 1 | Capacity in GiB, from 1 to 300. |
memorystore_redis_version | REDIS_7_2 | Redis version. |
memorystore_private_range_cidr | 10.252.0.0/24 | Range for private service access, /24 or more. |