What does running Redis really cost beyond the node-hour price?
Comparing an ElastiCache node-hour against an EC2 worker's node-hour tells you little. A cache's monthly cost includes everything needed to keep it available, durable enough for your use case, and observable. Engineering time is often the largest item.
A fair comparison starts with matching topology. If production uses a primary with one replica across two Availability Zones and automatic failover, the self-hosted side needs the same: at least two Redis pods on separate nodes in separate zones, plus Sentinel or an operator to handle promotion. Pricing a replicated managed cluster against a single pod compares an HA service with a single point of failure.
| Line item | ElastiCache | Self-managed on Kubernetes |
|---|---|---|
| Compute | Node-hour price per node | Worker node share, sized for Redis plus sidecars |
| Memory headroom | Reserved overhead set by the service | You size it: fork/copy-on-write, fragmentation, buffers |
| Persistence storage | Handled by the service | Persistent volumes for RDB/AOF, per replica |
| Cross-AZ transfer | Replication and client traffic across zones | Same traffic, same charges |
| Backups | Snapshots to managed storage | Your jobs, object storage, restore testing |
| Monitoring | Built-in metrics | Exporter, dashboards, alert rules you maintain |
| Engineering hours | Lower, not zero | On-call, upgrades, failover drills, incidents |
The model reduces to one formula:
Monthly TCO = compute + storage + transfer + backups + monitoring + (engineering hours × loaded hourly rate)
The last term usually decides the outcome. A few hours a month of upgrade work and incident response can cost more than the difference in compute, so estimate it from your team's actual on-call record.
Who should use this comparison?
This model is for engineers and engineering managers deciding where a Redis-compatible cache should run. That includes platform teams weighing whether to consolidate caches onto existing Kubernetes clusters, application teams choosing a cache for a new service, and anyone reviewing a cache bill that has grown with traffic.
It is most useful if:
- You already run on AWS and ElastiCache is the default managed option.
- You operate, or are considering, Kubernetes clusters that could host stateful workloads.
- Your cache matters enough to need replication and failover, so a single pod is not an acceptable baseline.
If your cache is small, disposable, and can be rebuilt from the source of truth in seconds, most of this analysis is overkill. A single managed node or an in-process cache is usually the right answer, and the deciding factor is convenience rather than TCO.
How does each option work?
The cost differences follow from how each option is built and operated.
ElastiCache. You choose an engine (Redis OSS, Valkey, or Memcached), a node type, and a topology. With cluster mode disabled, a replication group has one shard: a primary plus read replicas. With cluster mode enabled, data is sharded across multiple node groups, each with its own primary and replicas. When Multi-AZ with automatic failover is enabled, the service detects a failed primary, promotes a replica, and updates the primary endpoint's DNS so clients reconnect to the new primary. A reader endpoint spreads read traffic across replicas. The service also schedules snapshots, applies engine patches during a maintenance window you choose, and publishes metrics. A serverless option removes node selection entirely and bills on stored data and compute consumed.
Self-hosted on Kubernetes. You run the Redis (or Valkey) binary in pods, usually managed by a StatefulSet so each pod keeps a stable name and its own persistent volume. Replication is configured with replicaof on the replicas. Failover comes from one of two mechanisms:
- Sentinel: separate Sentinel processes monitor the primary, agree by quorum that it is down, promote a replica, and reconfigure the others. Clients ask Sentinel for the current primary's address instead of hard-coding it.
- Redis Cluster: the keyspace is split into 16,384 hash slots spread across multiple primaries. Nodes gossip about health and promote a replica when a primary fails. Clients must be cluster-aware and follow redirections.
Many teams use a Kubernetes operator to automate this wiring, but the operator is itself software you install, upgrade, and debug. Persistence (RDB snapshots, AOF), backups to object storage, metrics exporters, TLS, and ACLs are all configured and maintained by your team.
In short, ElastiCache sells you the control plane: failure detection, promotion, endpoint updates, patching, and snapshots. Self-hosting means you build or adopt that control plane and own its failure modes.
How does memory and replica overhead change the bill on each side?
Redis keeps the entire dataset in RAM, so the dataset size is only a lower bound on the memory you pay for. Three effects push actual usage higher:
- Fork-based persistence. RDB snapshots and AOF rewrites fork the process. The child shares memory pages with the parent through copy-on-write, but every page the parent modifies during the fork gets duplicated. On a write-heavy instance, peak usage during a snapshot can approach twice the dataset size.
- Replication buffers. Each replica needs a client output buffer on the primary, and the primary also keeps a replication backlog so that briefly disconnected replicas can resync without a full copy.
- Fragmentation. The allocator rarely returns freed memory cleanly, especially when value sizes vary.
mem_fragmentation_ratioinINFO memoryshows how far resident memory exceeds what Redis thinks it is using.
ElastiCache handles this by reserving a configurable percentage of each node's memory for overhead. That reserved memory is part of the node you pay for, but you cannot store data in it.
On Kubernetes you size this headroom yourself, and the node adds its own overhead. The kubelet sets aside memory for system and Kubernetes reservations and eviction thresholds. DaemonSets for logging, metrics, and networking take more. Because Redis pods need large memory requests, they often leave unusable gaps on a node unless you give them dedicated node pools.
Replicas multiply all of this. A primary with two replicas holds three full copies of the data, each with its own headroom, whether the nodes are managed or self-hosted.
How much does cross-AZ data transfer add to a Redis cache?
Those copies also have to stay in sync, and that is where a cost appears that rarely shows up in a node-hour comparison. To survive a zone failure, replicas usually sit in different availability zones from the primary. Every write is then sent across a zone boundary to each replica. Any client in a different zone from the node it talks to also generates cross-AZ traffic. In a self-managed cluster on Kubernetes, the cloud provider bills all of this as ordinary inter-AZ transfer, usually per GB in each direction.
Managed services generally do not bill for replication inside the cluster. Client-to-node traffic across zones is still billed on both sides, so confirm current terms before you rely on this.
A simple estimate of cross-AZ bytes per second:
R × [ r × S × f + w × S × (f + n) ]
- R is requests per second.
- r and w are the read and write fractions.
- S is the average payload size.
- f is the fraction of clients outside the primary's zone.
- n is the number of replicas in other zones.
Illustrative estimate, all inputs assumed: 20,000 req/s, 2 KB payloads, 90/10 reads to writes, clients spread evenly over three zones (f ≈ 0.67), and two cross-zone replicas. That works out to about 35 MB/s, or roughly 90 TB over a 30-day month. At an assumed $0.02/GB combined rate, the cost is around $1,800 a month. Routing reads to same-zone replicas cuts this sharply.
Backup storage, and copying snapshots to another region, are also commonly left out of both columns. For large datasets, that omission alone can flip the result.
SECONDS_PER_MONTH = 30 * 24 * 3600
def cross_az_bytes_per_sec(R, r, w, S, f, n):
# Reads cross a zone boundary only when the client is outside the serving node's zone.
# Writes go to the primary (fraction f cross zones), then to each of n cross-zone replicas.
return R * (r * S * f + w * S * (f + n))
def monthly_cost(bps, usd_per_gb):
gb = bps * SECONDS_PER_MONTH / 1e9 # decimal GB, as cloud bills usually use
return gb, gb * usd_per_gb
R = 20_000 # requests per second (assumed)
S = 2_000 # average payload in bytes, ~2 KB (assumed)
r, w = 0.9, 0.1 # read/write split (assumed)
f = 2 / 3 # clients spread evenly over three zones
n = 2 # replicas in other zones
RATE = 0.02 # assumed combined USD per GB (both directions)
bps = cross_az_bytes_per_sec(R, r, w, S, f, n)
gb, usd = monthly_cost(bps, RATE)
print(f"reads to primary: {bps/1e6:5.1f} MB/s {gb/1e3:6.1f} TB/mo ${usd:,.0f}/mo")
bps_local = R * (w * S * (f + n))
gb, usd = monthly_cost(bps_local, RATE)
print(f"same-zone reads: {bps_local/1e6:5.1f} MB/s {gb/1e3:6.1f} TB/mo ${usd:,.0f}/mo")
A small Python calculator that applies the section's formula to the assumed inputs (about 35 MB/s, ~90 TB and ~$1,800 per month) and shows how routing reads to same-zone replicas reduces the cross-AZ bill, as an illustrative estimate only.
Where is the break-even point? An illustrative estimate
Illustrative estimate (assumed numbers, not a benchmark). The node-hour prices below are placeholders. Replace them with current list prices for your region and instance family.
Assumed workload: a 40 GB dataset, about 50,000 ops/sec, and one primary with two replicas spread across three AZs, giving N = 3 nodes on similarly sized instances. Engineering time is costed at $100/hour. The managed service is assumed to need 2 hours per month of operational work. Self-hosting on Kubernetes is assumed to need 10 hours, covering operator and chart upgrades, failover drills, persistent-volume issues and alert tuning. Cross-AZ transfer is excluded because it is roughly the same on both sides.
Monthly total = N × 730 × node price + N × storage + engineering hours × rate
| Line item | Managed | Self-managed on Kubernetes |
|---|---|---|
| Node price (placeholder) | $1.00/hr | $0.70/hr |
| Compute (3 × 730 h) | $2,190 | $1,533 |
| Persistent volumes | included | $60 |
| Engineering time | 2 h → $200 | 10 h → $1,000 |
| Total | $2,390 | $2,593 |
Each self-managed node saves $199 a month: ($1.00 − $0.70) × 730, minus $20 of storage. The extra engineering costs $800 a month. That puts break-even at 800 ÷ 199 ≈ 4 nodes. At 12 nodes, self-hosting saves about $1,590 a month. If the extra engineering doubles to 16 hours, break-even moves to about 8 nodes.
Toil is not spread evenly across months, which is why the averages can mislead. A single replication incident or a stalled major-version upgrade can take 20 hours, which is $2,000 at the assumed rate. That wipes out a month of savings for a 12-node fleet, and the figure still leaves out the cost of the downtime.
How do you run Redis on Kubernetes in production?
A production Redis deployment on Kubernetes rests on a StatefulSet. It gives each pod a stable name and its own PersistentVolumeClaim through volumeClaimTemplates, so a replica restarts with its data and identity intact. Spread pods across zones with topologySpreadConstraints on topology.kubernetes.io/zone, or with required pod anti-affinity. Add a PodDisruptionBudget (policy/v1) with maxUnavailable: 1 so a node drain cannot remove a primary and its replica together. The annotated snippet below shows both objects.
Set resource requests carefully:
- Memory: set the memory request equal to the limit to avoid eviction under node pressure. Set
maxmemorywell below that limit, because the fork forBGSAVEor replica sync can grow resident memory through copy-on-write. - CPU: CPU limits cause CFS throttling, which appears as p99 latency spikes. Many teams set a CPU request with no limit, or use dedicated node pools.
For failover, you need either Sentinel or Redis Cluster. Each adds its own moving parts.
The hidden costs come from failure modes:
- Zone-bound volumes: block volumes are tied to one zone. If that zone loses capacity, the pod stays Pending until you rebuild it elsewhere from a replica or backup.
- Stale topology: after a reschedule, clients that cached old pod IPs or the old primary can write to a demoted node. Without correctly tuned quorum and
min-replicas-to-write, this causes split-brain and lost writes. - Noisy neighbors: other pods on a shared node compete for CPU and network and raise tail latency.
- Backups: an RDB snapshot is only a backup once you have timed a restore from it.
Your team also takes on security patching, TLS certificate rotation, ACL management, and audit logging.
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: redis
spec:
serviceName: redis # headless Service: stable DNS names like redis-0.redis
replicas: 3 # one primary + two replicas; Sentinel or Cluster handles failover
selector: {matchLabels: {app: redis}}
template:
metadata:
labels: {app: redis}
spec:
topologySpreadConstraints: # one pod per zone so a zone outage takes out at most one
- maxSkew: 1
topologyKey: topology.kubernetes.io/zone
whenUnsatisfiable: DoNotSchedule
labelSelector: {matchLabels: {app: redis}}
containers:
- name: redis
image: redis:7.2 # pinned tag; patching and upgrades are now your job
# maxmemory well under the 4Gi limit leaves room for fork copy-on-write during BGSAVE/sync
args: ["--maxmemory", "3gb", "--appendonly", "yes"]
resources:
requests: {cpu: "1", memory: 4Gi}
limits: {memory: 4Gi} # memory request == limit; no CPU limit to avoid CFS throttling
volumeMounts:
- {name: data, mountPath: /data}
volumeClaimTemplates: # one PVC per pod; block volumes stay bound to their zone
- metadata: {name: data}
spec:
accessModes: ["ReadWriteOnce"]
resources: {requests: {storage: 20Gi}}
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata: {name: redis}
spec:
maxUnavailable: 1 # node drains evict at most one Redis pod at a time
selector: {matchLabels: {app: redis}}
A minimal Redis StatefulSet spread across zones with per-pod volumes and throttle-free resource settings, plus a policy/v1 PodDisruptionBudget that limits voluntary disruptions to one pod at a time.
How do Valkey, serverless, and reserved pricing shift the comparison?
Licensing is now part of the cost model. When Redis moved from a permissive BSD licence to source-available terms, the Linux Foundation backed Valkey, a BSD-licensed fork of the last open release. For self-managed clusters, this means choosing an engine. Valkey keeps the familiar protocol and gives your legal team a simple answer. Staying on Redis means reading its current licence terms for your use case. On the managed side, ElastiCache offers both engines and prices Valkey below Redis OSS. The engine choice therefore changes the managed bill directly, without any change to the workload.
Several levers reduce the managed bill:
- Reserved nodes: one- or three-year commitments lower the hourly rate. They only pay off if the node family stays the same for the whole term.
- Right-sizing: right-size against measured peak memory plus replication headroom, not against the instance you started with. Larger nodes are often oversized.
- Billing model: choose serverless or provisioned based on how steady your traffic is (see table).
| Model | You pay for | Fits | Risk |
|---|---|---|---|
| Provisioned on-demand | Node-hours | Variable or new workloads | Idle capacity |
| Provisioned reserved | Committed node-hours | Steady, predictable load | Stranded commitment |
| Serverless | Data stored plus ECPUs consumed | Spiky or low-volume traffic | Cost grows with sustained throughput |
| Self-managed | Compute, storage, engineer time | Large, stable fleets | Operational burden |
The managed premium also includes constraints that never show up as a line item:
- Some configuration parameters are restricted.
- Engine versions follow the provider's release schedule.
- Maintenance windows are imposed on you.
- Provider-specific features, such as serverless scaling, make it harder to migrate away later.
Pricing for every option in the table changes over time, so rerun the comparison whenever a contract renews or a new engine option ships.
What are the alternatives to both options?
The choice is not only ElastiCache versus Redis on Kubernetes. Depending on the workload, one of these may beat both:
- Redis or Valkey on plain virtual machines. Running the engine directly on EC2 instances with Sentinel avoids Kubernetes scheduling overhead, kubelet reservations, and DaemonSet sidecars. You still own patching, failover, and backups, but with fewer layers to debug. This suits teams that are comfortable with VM configuration management but do not run stateful workloads on Kubernetes.
- Memcached. If you only need a volatile key-value cache with no persistence, replication, or rich data types, Memcached is simpler to operate and scales out by adding nodes, with sharding handled by the client. It is available both self-hosted and as an ElastiCache engine. Losing a node means losing its keys, so it fits caches that can be refilled from the source of truth.
- In-process or local caches. A per-instance in-memory cache in the application removes network hops and cross-AZ transfer entirely. It works for small, read-heavy, hot datasets where brief inconsistency between instances is acceptable. It does not work for shared state such as sessions, rate limits, or distributed locks.
- Caching in the database layer. Read replicas, materialized views, or the database's own buffer cache can sometimes absorb the read load a separate cache was added for. This removes a system to operate, at the cost of database capacity.
- A managed Redis-compatible service on another platform. If workloads are moving off AWS, the destination platform's managed cache changes the comparison. Rebuild this TCO model with that provider's pricing rather than assuming the same ratios.
Use the same formula for each alternative: compute, storage, transfer, backups, monitoring, and engineering hours. Simpler options often win on the last term even when their compute cost is higher.
When should you self-host Redis, and when should you avoid it?
The deciding factor is rarely the node-hour price. It is whether your organization already pays for the engineering time that a self-hosted cache requires.
| Situation | Lean toward | Why |
|---|---|---|
| One to a few clusters | Managed | Operator setup, runbooks, and on-call cost the same for one cluster as for fifty |
| Critical cache, no dedicated platform team | Managed | Failover, patching, and backups become someone's side job |
| Compliance-driven environment | Managed | Inherited audit evidence and certifications reduce review work |
| Large fleet of clusters | Self-host | Automation cost is spread across many clusters |
| Team already runs stateful workloads on Kubernetes | Self-host | Storage, anti-affinity, and disruption budgets are already solved problems |
| Spare node capacity in existing clusters | Self-host | Marginal infrastructure cost approaches zero |
Managed service saves developer time in specific places. Engine patching, replica promotion, snapshot scheduling, and restore testing are all handled for you, so no one has to write or rehearse those procedures. Self-hosting saves money only once that automation exists and has been proven in practice. Building it for a single cache usually costs more in engineer-weeks than years of the managed premium.
Before migrating in either direction
- Who is paged when the primary fails at 3 a.m., and have they done a failover drill?
- Have you tested a restore from backup, and do you know how long it takes?
- How will you take engine upgrades and security patches, and how quickly?
- Will client libraries and connection settings work unchanged on the target?
- What is the cutover plan, and can you roll back if hit rates or latency regress?
- Does any compliance control depend on the current hosting model?
How OneEnv can help
Disclosure: OneEnv is the product behind this blog.
OneEnv (oneenv.io) is a workspace-based governance platform for the things services share — environment variables, database structure, API routes and validation rules. A change to a shared value is staged on a branch, reviewed once, and then every affected service explicitly approves or rejects it before it goes live, so you can see who a change touches before it ships instead of finding out in production.
Applied to elasticache cost vs self hosted redis, this is where it helps:
Saves time
- Every service that inherits a shared value is listed in one place, so nobody searches repos and chats to find out who is affected.
- One review per branch replaces coordinating each team separately; each service still keeps its own approve/reject.
- Reviewers see the exact diff and the list of affected services up front, so approval is a decision rather than an investigation.
Saves cost
- Fewer production incidents and rollbacks caused by a shared value, route or column changing under a consumer unannounced.
- Less duplicated configuration to maintain: one shared definition inherited by many services.
- Per-service approve/reject means a bad shared value can be refused where it would break something, before it is live.
- OneEnv has a free plan (1 workspace, unlimited services and members, full governance), so trying it costs nothing.
These are qualitative benefits, not measured results — how much you save depends on how many services share the value.
Want to try it? Start at oneenv.io.