# CloudWatch alarm for ElastiCache DatabaseMemoryUsagePercentage

CloudWatch alarms · Updated 16 November 2026

**Short answer:** DatabaseMemoryUsagePercentage is how much of the memory available to the Redis OSS or Valkey engine (its maxmemory) is in use, per CacheClusterId. AWS recommends alarming on the Average above a threshold you choose for 5 of 5 one-minute periods. At 100%, the eviction policy kicks in, and if nothing can be evicted, writes fail.

## What happens as memory fills

The percentage is used memory divided by `maxmemory`, the part of the node's RAM the engine is allowed to use after ElastiCache reserves some for background work such as snapshots and replication. Reaching 100% is not a crash; it triggers the `maxmemory-policy`:

| Policy style | At 100% |
|---|---|
| `volatile-lru` and other `volatile-*` | Evicts keys that have a TTL; if none are left, writes fail |
| `allkeys-lru` / `allkeys-lfu` | Evicts any key; behaves like a classic cache |
| `noeviction` | Rejects writes with an out-of-memory error |

The reserved share is controlled by the `reserved-memory-percent` parameter; lowering it raises `maxmemory` but leaves less room for snapshots, which can make the node swap during backups. Whether this alarm matters depends on the eviction policy. A pure cache with `allkeys-lru` is designed to sit near 100%. A cluster used as a session store, queue or primary data store must never get there.

## Recommended alarm settings

| Setting | Value |
|---|---|
| Namespace | `AWS/ElastiCache` |
| Metric | `DatabaseMemoryUsagePercentage` |
| Dimensions | `CacheClusterId` |
| Statistic | `Average` |
| Period | 60 seconds |
| Datapoints to alarm | 5 |
| Evaluation periods | 5 |
| Comparison operator | `GreaterThanThreshold` |
| Threshold | Depends on your situation: the level that leaves you time to scale |

From AWS's CloudWatch [recommended alarms](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Best_Practice_Recommended_Alarms_AWS_Services.html) page.

## Choosing a threshold

- **Data you cannot lose** (sessions, rate-limit counters, anything without a backing store): alarm at 75–80%, leaving time to scale before evictions or write failures.
- **Caches that expect eviction:** this alarm will fire constantly. Alarm on the `Evictions` metric rising well above its normal rate instead, together with a drop in cache hit rate.
- **Growth rate matters:** graph the metric over a month. If it rises a few points a week, set the threshold so that the alarm fires several weeks before 100%.

## Create it

```
# 80% suits a session store; caches that rely on eviction should alarm on Evictions instead
aws cloudwatch put-metric-alarm \
  --alarm-name sessions-memory-high \
  --namespace AWS/ElastiCache \
  --metric-name DatabaseMemoryUsagePercentage \
  --dimensions Name=CacheClusterId,Value=sessions-001 \
  --statistic Average \
  --period 60 \
  --evaluation-periods 5 \
  --datapoints-to-alarm 5 \
  --threshold 80 \
  --comparison-operator GreaterThanThreshold \
  --alarm-actions arn:aws:sns:eu-west-2:123456789012:ops-alerts \
  --region eu-west-2
```

## When it fires

1. **Find what is growing.** Keys without a TTL that were meant to expire are the usual cause. Sample keys with `SCAN` and `TTL`, or use `MEMORY USAGE` on suspect keys. Avoid `KEYS *` in production.
2. **Add TTLs** in the application where data is temporary.
3. **Add memory:** scale up to a larger node type, or with cluster mode enabled, add shards to spread the data. See AWS's [scaling guide](https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/Scaling.html).
4. **Check the policy** with `aws elasticache describe-cache-parameters --cache-parameter-group-name my-params --query "Parameters[?ParameterName=='maxmemory-policy']"`; it may not be what the application expects.

## Questions

### What happens when ElastiCache memory reaches 100%?

The eviction policy runs. With a volatile policy and no keys with a TTL, or with noeviction, write commands fail with an out-of-memory error.

### Is high DatabaseMemoryUsagePercentage bad for a cache?

Not necessarily. A cache using allkeys-lru is meant to fill up and evict. Watch evictions and hit rate instead.

### Why is maxmemory lower than the node's RAM?

ElastiCache reserves part of the memory for snapshots, replication and overhead, so the engine gets less than the full node size.

## When this happens away from your desk

A cache running out of memory can quietly drop sessions or fail writes. CloudConsole, a phone app for AWS, is built to show this alarm with the memory trend so you can see how much time you have.

[About the CloudConsole app](https://cloudconsole.dev/aws-console-app) · [Download on the App Store](https://apps.apple.com/app/cloudconsole-for-aws/id6835419710)

## Sources

- [Recommended alarms for AWS services (Amazon CloudWatch User Guide)](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Best_Practice_Recommended_Alarms_AWS_Services.html)
- [Scaling ElastiCache clusters](https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/Scaling.html)

## Related

- [CloudWatch alarm for ElastiCache CPUUtilization](https://cloudconsole.dev/alarms/elasticache-cpuutilization)
- [CloudWatch alarm for ElastiCache EngineCPUUtilization](https://cloudconsole.dev/alarms/elasticache-enginecpuutilization)
- [CloudWatch alarm for ElastiCache CurrConnections](https://cloudconsole.dev/alarms/elasticache-currconnections)
- [CloudWatch alarm for ElastiCache ReplicationLag](https://cloudconsole.dev/alarms/elasticache-replicationlag)
- [CloudWatch alarm: RDS FreeableMemory](https://cloudconsole.dev/alarms/rds-freeablememory)

---

Source: https://cloudconsole.dev/alarms/elasticache-databasememoryusagepercentage

CloudConsole is an independent iPhone and Android app for Amazon Web Services by Cloudconcur Ltd. It is not affiliated with Amazon Web Services.
