AWSAmazon MemoryDBDatabase

aws_memorydb_cluster cost estimation

A durable, Redis-compatible in-memory database. Priced per node-hour across all shards and replicas, plus per-GB data written and snapshot storage.

An aws_memorydb_cluster is Amazon's durable Redis-compatible database: it keeps an in-memory primary like ElastiCache but adds a multi-AZ transaction log for durability, so it can serve as a primary datastore, not just a cache. That durability is why it costs more than ElastiCache for the same node type.

The dominant cost is node-hours. Total nodes are num_shards multiplied by (1 + num_replicas_per_shard), each billed at the per-hour rate for the node type. The r6g and r7g (Graviton) families give the best price-performance; Valkey-engine nodes are priced slightly lower than Redis. On top of node-hours, MemoryDB charges for data written to the durable log at roughly $0.20/GB, which has no ElastiCache equivalent, plus snapshot storage beyond the free allowance.

c3x reads node_type, num_shards, and num_replicas_per_shard and prices node-hours at 730 hours/month. Data-written and snapshot storage are usage-based dimensions supplied in c3x-usage.yml. The data-written charge is the line that surprises teams migrating from ElastiCache, so it's worth modelling for write-heavy workloads.

Terraform example

A minimal but realistic configuration that C3X can estimate.

resource "aws_memorydb_cluster" "main" {
  name                     = "main"
  node_type                = "db.r6g.large"
  num_shards               = 2
  num_replicas_per_shard   = 1
  acl_name                 = "open-access"

  engine = "redis"
}

Pricing dimensions

What you actually pay for when you provision aws_memorydb_cluster.

DimensionUnitWhat's being charged
Node hoursper node-hourOn-demand rate per node, billed across all nodes. Total = num_shards x (1 + num_replicas_per_shard). c3x assumes 730 hours/month.
$0.2163/hour for db.r7g.large (Valkey)
Data writtenper GBData written to the durable multi-AZ transaction log. Unique to MemoryDB; no ElastiCache equivalent. Usage-based.
$0.20/GB written
Snapshot storageper GB-monthBackup storage beyond the free allowance equal to one cluster's size. Usage-based.

Sample C3X output

Example output from c3x estimate (db.r6g.large, 2 shards x 2 nodes = 4):

aws_memorydb_cluster.main
└─ Nodes (db.r6g.large x 4)   2,920  node-hours    $1,250.36

OVERALL TOTAL                                      $1,250.36
(data-written & snapshots usage-based)

Optimization tips

Common ways to reduce aws_memorydb_cluster cost without changing the workload.

Use ElastiCache if you don't need durability

Premium + data-written

MemoryDB's premium over ElastiCache buys the durable transaction log and data-written charge. If you're using it purely as a cache, aws_elasticache_replication_group is cheaper with no data-written fee.

Choose Valkey and Graviton nodes

~15%

Valkey-engine nodes price slightly below Redis, and r7g Graviton beats r6g/r5 on price-performance. Combined, they trim the per-node rate meaningfully.

Right-size replicas

Per avoided replica

Each replica is a full-priced node. One replica per shard gives multi-AZ HA; a second is only for read scaling. Don't over-replicate.

FAQ

How does c3x estimate MemoryDB cost?

It multiplies num_shards by (1 + num_replicas_per_shard) for the node count, prices each at the on-demand node_type rate (Redis or Valkey) at 730 hours/month, and treats data-written and snapshot storage as usage-based dimensions.

Why is MemoryDB more expensive than ElastiCache?

MemoryDB adds a durable multi-AZ transaction log so it can be a primary datastore. That durability raises the node rate and adds a per-GB data-written charge that ElastiCache doesn't have.

What is the data-written charge?

Every GB written to MemoryDB's durable log bills at roughly $0.20/GB. For write-heavy workloads this can be a significant line, so model it from expected write volume in c3x-usage.yml.

Does engine choice change the price?

Yes. Valkey-engine nodes are priced slightly lower than Redis for the same node type. c3x reads the engine attribute and applies the matching rate.

Can I reserve MemoryDB nodes?

Yes. Reserved nodes cut the rate for 1- or 3-year terms. Since MemoryDB clusters are steady-state datastores, they're good reservation candidates; model with purchaseOption in c3x-usage.yml.

Related resources

Estimate this resource in your own Terraform

Free, open source, no API key. C3X parses your Terraform and shows line-item cost for every resource, including aws_memorydb_cluster.