

# Logging and monitoring in Amazon ElastiCache
Logging and monitoring

To manage your cache, it's important that you know how your caches are performing. ElastiCache generates metrics that are published to Amazon CloudWatch Logs for monitoring your cache performance. In addition, ElastiCache generates events when significant changes happen on your cache resources (e.g. a new cache is created, or a cache is deleted). 

**Topics**
+ [

# Metrics and events for Valkey and Redis OSS serverless caches
](serverless-metrics-events-redis.md)
+ [

# Metrics and events for node-based Valkey and Redis OSS clusters
](self-designed-metrics-events.valkey-and-redis.md)
+ [

# Metrics and events for Memcached caches and clusters
](serverless-metrics-events.memcached.md)
+ [

# Logging Amazon ElastiCache API calls with AWS CloudTrail
](logging-using-cloudtrail.md)
+ [

# Amazon SNS monitoring of ElastiCache events
](ECEvents.md)
+ [

# Log delivery
](Log_Delivery.md)
+ [

# Monitoring use with CloudWatch Metrics
](CacheMetrics.md)

# Metrics and events for Valkey and Redis OSS serverless caches
Metrics and events for Valkey and Redis OSS serverless

ElastiCache offers a wide variety of metrics and events for monitoring when working with serverless caches. This includes CloudWatch metrics, command level metrics, and event logs which can be ingested via Amazon EventBridge. 

**Topics**
+ [

## Serverless cache metrics
](#serverless-metrics)
+ [

## Serverless cache events
](#serverless-events)

## Serverless cache metrics
Serverless metrics

The `AWS/ElastiCache` namespace includes the following CloudWatch metrics for your Valkey or Redis OSS serverless caches.

*Metric codes for Valkey or Redis OSS*


| Metric | Description | Unit | 
| --- | --- | --- | 
|  BytesUsedForCache  |  The total number of bytes used by the data stored in your cache.  |  Bytes  | 
|  ElastiCacheProcessingUnits  |  The total number of ElastiCacheProcessingUnits (ECPUs) consumed by the requests executed on your cache  |  Count  | 
|  SuccessfulReadRequestLatency  |  Latency of successful read requests.  |  Microseconds  | 
|  SuccessfulWriteRequestLatency  |  Latency of successful write requests  |  Microseconds  | 
|  TotalCmdsCount  |  Total count of all commands executed on your cache  |  Count  | 
|  CacheHitRate  |  Indicates the hit rate of your cache. This is calculated using `cache_hits` and `cache_misses` statistics in the following way: `cache_hits /(cache_hits + cache_misses)`.  |  Percent  | 
|  CacheHits  |  The number of successful read-only key lookups in the cache.  |  Count  | 
|  CacheMisses  |  The number of unsuccessful read-only key lookups in the cache.  |  Count  | 
|  CurrConnections  |  The number of client connections to your cache.  |  Count  | 
|  ThrottledCmds  |  The number of requests that were throttled by ElastiCache because the workload was scaling faster than ElastiCache can scale.  |  Count  | 
|  NewConnections  |  The total number of connections that have been accepted by the server during this period.  |  Count  | 
|  CurrItems  |  The number of items in the cache.  |  Count  | 
|  CurrVolatileItems  |  The number of items in the cache with TTL.  |  Count  | 
|  NetworkBytesIn  |  Total bytes transferred in to cache  |  Bytes  | 
|  NetworkBytesOut  |  Total bytes transferred out of cache  |  Bytes  | 
|  Evictions  |  The count of keys evicted by the cache  |  Count  | 
|  IamAuthenticationExpirations  |  The total number of expired IAM-authenticated Valkey or Redis OSS connections. You can find more information about [Authenticating with IAM](auth-iam.md) in the user guide.  |  Count  | 
|  IamAuthenticationThrottling  |  The total number of throttled IAM-authenticated Valkey or Redis OSS AUTH or HELLO requests. You can find more information about [Authenticating with IAM](auth-iam.md) in the user guide.   |  Count  | 
|  KeyAuthorizationFailures  |  The total number of failed attempts by users to access keys they don’t have permission to access. We suggest setting an alarm on this to detect unauthorized access attempts.  |  Count  | 
|  AuthenticationFailures  |  The total number of failed attempts to authenticate to Valkey or Redis OSS using the AUTH command. We suggest setting an alarm on this to detect unauthorized access attempts.  |  Count  | 
|  CommandAuthorizationFailures  |  The total number of failed attempts by users to run commands they don’t have permission to call. We suggest setting an alarm on this to detect unauthorized access attempts.  |  Count  | 

**Command level metrics**

ElastiCache also emits the following command level metrics. For each command type, ElastiCache emits the total count of commands and the number of ECPUs consumed by that command type. 


| Metric | Description | Unit | 
| --- | --- | --- | 
|  EvalBasedCmds  |  The number of get commands the cache has received.  |  Count  | 
|  EvalBasedCmdsECPUs  |  ECPUs consumed by eval-based commands.  |  Count  | 
|  GeoSpatialBasedCmds  |  The total number of commands for geospatial-based commands. This is derived from the Valkey or Redis OSS commandstats statistic. It's derived by summing all of the geo type of commands: geoadd, geodist, geohash, geopos, georadius, and georadiusbymember.  |  Count  | 
|  GeoSpatialBasedCmdsECPUs  |  ECPUs consumed by geospatial-based commands.  |  Count  | 
|  GetTypeCmds  |  The total number of read-only type commands. This is derived from the Valkey or Redis OSS commandstats statistic by summing all of the read-only type commands (get, hget, scard, lrange, and so on.)  |  Count  | 
|  GetTypeCmdsECPUs  |  ECPUs consumed by read commands.  |  Count  | 
|  HashBasedCmds  |  The total number of commands that are hash-based. This is derived from the Valkey or Redis OSS commandstats statistic by summing all of the commands that act upon one or more hashes (hget, hkeys, hvals, hdel, and so on).  |  Count  | 
|  HashBasedCmdsECPUs  |  ECPUs consumed by hash-based commands.  |  Count  | 
|  HyperLogLogBasedCmds  |  The total number of HyperLogLog-based commands. This is derived from the Valkey or Redis OSS commandstats statistic by summing all of the pf type of commands (pfadd, pfcount, pfmerge, and so on.).  |  Count  | 
|  HyperLogLogBasedCmdsECPUs  |  ECPUs consumed by HyperLogLog-based commands.  |  Count  | 
|  JsonBasedCmds  |  The total number of JSON commands, including both read and write commands. This is derived from the Valkey or Redis OSS commandstats statistic by summing all JSON commands that act upon JSON keys.  |  Count  | 
|  JsonBasedCmdsECPUs  |  ECPUs consumed by all JSON commands, including both read and write commands.  |  Count  | 
|  JsonBasedGetCmds  |  The total number of JSON read-only commands. This is derived from the Valkey or Redis OSS commandstats statistic by summing all JSON read commands that act upon JSON keys.  |  Count  | 
|  JsonBasedGetCmdsECPUs  |  ECPUs consumed by JSON read-only commands.  |  Count  | 
|  JsonBasedSetCmds  |  The total number of JSON write commands. This is derived from the Valkey or Redis OSS commandstats statistic by summing all JSON write commands that act upon JSON keys.  |  Count  | 
|  JsonBasedSetCmdsECPUs  |  ECPUs consumed by JSON write commands.  |  Count  | 
|  KeyBasedCmds  |  The total number of commands that are key-based. This is derived from the Valkey or Redis OSS commandstats statistic by summing all of the commands that act upon one or more keys across multiple data structures (del, expire, rename, and so on.).  |  Count  | 
|  KeyBasedCmdsECPUs  |  ECPUs consumed by key-based commands.  |  Count  | 
|  ListBasedCmds  |  The total number of commands that are list-based. This is derived from the Valkey or Redis OSS commandstats statistic by summing all of the commands that act upon one or more lists (lindex, lrange, lpush, ltrim, and so on).  |  Count  | 
|  ListBasedCmdsECPUs  |  ECPUs consumed by list-based commands.  |  Count  | 
|  NonKeyTypeCmds  |  The total number of commands that are not key-based. This is derived from the Valkey or Redis OSS commandstats statistic by summing all of the commands that do not act upon a key, for example, acl, dbsize or info.  |  Count  | 
|  NonKeyTypeCmdsECPUs  |  ECPUs consumed by non-key-based commands.  |  Count  | 
|  PubSubBasedCmds  |  The total number of commands for pub/sub functionality. This is derived from the Valkey or Redis OSS commandstatsstatistics by summing all of the commands used for pub/sub functionality: psubscribe, publish, pubsub, punsubscribe, ssubscribe, sunsubscribe, spublish, subscribe, and unsubscribe.  |  Count  | 
|  PubSubBasedCmdsECPUs  |  ECPUs consumed by pub/sub-based commands.  |  Count  | 
|  SetBasedCmds  |  The total number of commands that are set-based. This is derived from the Valkey or Redis OSS commandstats statistic by summing all of the commands that act upon one or more sets (scard, sdiff, sadd, sunion, and so on).  |  Count  | 
|  SetBasedCmdsECPUs  |  ECPUs consumed by set-based commands.  |  Count  | 
|  SetTypeCmds  |  The total number of write types of commands. This is derived from the Valkey or Redis OSS commandstats statistic by summing all of the mutative types of commands that operate on data (set, hset, sadd, lpop, and so on.)  |  Count  | 
|  SetTypeCmdsECPUs  |  ECPUs consumed by write commands.  |  Count  | 
|  SortedSetBasedCmds  |  The total number of commands that are sorted set-based. This is derived from the Valkey or Redis OSS commandstats statistic by summing all of the commands that act upon one or more sorted sets (zcount, zrange, zrank, zadd, and so on).  |  Count  | 
|  SortedSetBasedCmdsECPUs  |  ECPUs consumed by sorted-based commands.  |  Count  | 
|  StringBasedCmds  |  The total number of commands that are string-based. This is derived from the Valkey or Redis OSS commandstats statistic by summing all of the commands that act upon one or more strings (strlen, setex, setrange, and so on).  |  Count  | 
|  StringBasedCmdsECPUs  |  ECPUs consumed by string-based commands.  |  Count  | 
|  StreamBasedCmds  |  The total number of commands that are stream-based. This is derived from the Valkey or Redis OSS commandstats statistic by summing all of the commands that act upon one or more streams data types (xrange, xlen, xadd, xdel, and so on).  |  Count  | 
|  StreamBasedCmdsECPUs  |  ECPUs consumed by stream-based commands.  |  Count  | 

## Serverless cache events
Serverless events



ElastiCache logs events that relate to your serverless cache. This information includes the date and time of the event, the source name and source type of the event, and a description of the event. You can easily retrieve events from the log using the ElastiCache console, the AWS CLI describe-events command, or the ElastiCache API action `DescribeEvents`.

You can choose to monitor, ingest, transform, and act on ElastiCache events using Amazon EventBridge. Learn more in the Amazon EventBridge [getting started guide](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-get-started.html).

**Viewing ElastiCache events (Console)**

To view events using the ElastiCache console:

1. Sign in to the AWS Management Console and open the ElastiCache console at [https://console.aws.amazon.com/elasticache/](https://console.aws.amazon.com/elasticache/)

1. To see a list of all available events, in the navigation pane, choose **Events**. 

1. On the *Events *screen each row of the list represents one event and displays the event source, the event type, the GMT time of the event, and a description of the event. Using the **Filter** you can specify whether you want to see all events, or just events of a specific type in the event list.

**Viewing ElastiCache events (AWS CLI)**

To generate a list of ElastiCache events using the AWS CLI, use the command describe-events. You can use optional parameters to control the type of events listed, the time frame of the events listed, the maximum number of events to list, and more.

The following code lists up to 40 serverless cache events.

```
aws elasticache describe-events --source-type serverless-cache --max-items 40
```

The following code lists all events for serverless caches for the past 24 hours (1440 minutes).

```
aws elasticache describe-events --source-type serverless-cache --duration 1440
```

**Serverless Events**

This section documents the different types of events that you may receive for your serverless caches. 

**Serverless Cache Creation Events**


| Detail-Type | Description | Unit | Source | Message | 
| --- | --- | --- | --- | --- | 
|  Cache created  |  Cache arn  |  creation  |  serverless-cache  |  Cache <cache-name> is created and ready to use.  | 
|  Cache created  |  Cache arn Snapshot arn  |  creation  |  serverless-cache  |  Cache <cache-name> is created and data was restored from snapshot. Your cache is ready to use.  | 
|  Cache creation failed  |  Cache arn  |  failure  |  serverless-cache  |  Failed to create cache <cache-name>. Insufficient free IP addresses to create VPC endpoint.  | 
|  Cache creation failed  |  Cache arn  |  failure  |  serverless-cache  |  Failed to create cache <cache-name>. Invalid subnets provided in the request.  | 
|  Cache creation failed  |  Cache arn  |  failure  |  serverless-cache  |  Failed to create cache <cache-name>. Quota limit reached for creating VPC endpoint.  | 
|  Cache creation failed  |  Cache arn  |  failure  |  serverless-cache  |  Failed to create cache <cache-name>. You do not have permissions to create a VPC endpoint.  | 
|  Cache creation failed  |  Cache arn  |  failure  |  serverless-cache  |  Failed to create cache <cache-name>. A user with an incompatible Valkey or Redis OSS version is present in user group <user-group-name>.  | 
|  Cache creation failed  |  Cache arn Cache snapshot arn  |  failure  |  serverless-cache  |  Failed to create cache <cache-name>. The provided user group <user-group-name> does not exist.  | 
|  Cache creation failed  |  Cache arn  |  failure  |  serverless-cache  |  Failed to create cache <cache-name>. Data restoration from snapshot failed because <reason>. Failure reasons: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/AmazonElastiCache/latest/dg/serverless-metrics-events-redis.html)  | 

**Serverless Cache Update Events (Valkey or Redis OSS)**


| Detail-Type | Resources list | Category | Source | Message | 
| --- | --- | --- | --- | --- | 
|  Cache updated  |  Cache arn  |  configuration change  |  serverless-cache  |  SecurityGroups updated for the cache <cache-name>.  | 
|  Cache updated  |  Cache arn  |  configuration change  |  serverless-cache  |  Tags updated for the cache <cache-name>.  | 
|  Cache updated failed  |  Cache arn  |  configuration change  |  serverless-cache  |  An update to the cache <cache-name> failed. A user with an incompatible Valkey or Redis OSS version is present in user group <user-group-name>.   | 
|  Cache updated failed  |  Cache arn  |  configuration change  |  serverless-cache  |  An update to the cache <cache-name> failed. SecurityGroups update failed.  | 
|  Cache updated failed  |  Cache arn  |  configuration change  |  serverless-cache  |  An update to the cache <cache-name> failed. SecurityGroups update failed because of insufficient permissions.  | 
|  Cache updated failed  |  Cache arn  |  configuration change  |  serverless-cache  |  An update to the cache <cache-name> failed. SecurityGroups update failed because the SecurityGroups are invalid.  | 

**Serverless Cache Deletion Events (Valkey or Redis OSS)**


| Detail-Type | Resources list | Category | Source | Message | 
| --- | --- | --- | --- | --- | 
|  Cache deleted  |  Cache arn  |  deletion  |  serverless-cache  |  Cache <cache-name> was deleted.  | 

**Serverless Cache Usage Limit Events (Valkey or Redis OSS)**


| Detail-Type | Description | Unit | Source | Message | 
| --- | --- | --- | --- | --- | 
|  Cache updated  |  Cache arn  |  configuration change  |  serverless-cache  |  Limits updated for the cache <cache-name>.  | 
|  Cache limit approaching  |  Cache arn  |  notification  |  serverless-cache  |  Slot <X> is using more than <Y>% of the per-slot limit of 32 GB. For example, Slot 10 is using more than 90% of the per-slot limit of 32 GB.  | 
|  Cache updated failed  |  Cache arn  |  failure  |  serverless-cache  |  A limit update to the cache <cache-name> failed because the cache was deleted.  | 
|  Cache updated failed  |  Cache arn  |  failure  |  serverless-cache  |  A limit update to the cache <cache-name> failed due to invalid configuration.  | 
|  Cache updated failed  |  Cache arn  |  failure  |  serverless-cache  |  A limit update to the cache <cache-name> failed because current cached data exceeds new limits. Please flush some data before applying the limits.  | 

**Serverless Cache Snapshot Events (Valkey or Redis OSS)**


| Detail-Type | Resources-list | Category | Source | Message | 
| --- | --- | --- | --- | --- | 
|  Snapshot created  |  Cache arn Snapshot arn  |  creation  |  serverless-cache-snapshot  |  Snapshot <snapshot-name> created for cache <cache-name>.  | 
|  Snapshot creation failed  |  Cache arn Snapshot arn  |  failure  |  serverless-cache-snapshot  |  Failed to create snapshot for cache <cache-name>. Snapshot <snapshot-name> creation failed with Customer Managed Key <key-id> <reason>. Failure reason messages: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/AmazonElastiCache/latest/dg/serverless-metrics-events-redis.html)  | 
|  Snapshot creation failed  |  Cache arn Snapshot arn  |  failure  |  serverless-cache-snapshot  |  Failed to create snapshot for cache <cache-name>. Snapshot <snapshot-name> creation failed because <reason>. Default reason: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/AmazonElastiCache/latest/dg/serverless-metrics-events-redis.html)  | 
|  Snapshot export failed  |  Snapshot arn  |  failure  |  serverless-cache-snapshot  |  Failed to export snapshot for cache <cache-name>. Could not export snapshot to bucket %s because ElastiCache does not have permissions to the bucket.  | 
|  Snapshot export failed  |  Snapshot arn  |  failure  |  serverless-cache-snapshot  |  Failed to export snapshot for cache <cache-name>. Could not export snapshot to bucket '%s' because there is already an object with the same name in the bucket.  | 
|  Snapshot export failed  |  Snapshot arn  |  failure  |  serverless-cache-snapshot  |  Failed to export snapshot for cache <cache-name>. Could not export snapshot to bucket '%s' because bucket owner account Id has changed.  | 
|  Snapshot export failed  |  Snapshot arn  |  failure  |  serverless-cache-snapshot  |  Failed to export snapshot for cache <cache-name>. Could not export snapshot to bucket '%s' because the S3 bucket is not accessible.  | 
|  Snapshot export failed  |  Snapshot arn  |  failure  |  serverless-cache-snapshot  |  Failed to export snapshot for cache <cache-name>. Could not export snapshot to bucket '%s' because the bucket is not accessible.  | 
|  Snapshot export failed  |  Snapshot arn  |  failure  |  serverless-cache-snapshot  |  Failed to export snapshot for cache <cache-name>. Could not export snapshot to bucket '%s' because bucket does not exist.  | 
|  Snapshot export failed  |  Snapshot arn  |  failure  |  serverless-cache-snapshot  |  Failed to export snapshot for cache <cache-name>. Could not export snapshot to bucket '%s' with source snapshot Customer Managed Key %s <reason>.  | 
|  Snapshot export failed  |  Snapshot arn  |  failure  |  serverless-cache-snapshot  |  Failed to export snapshot for cache <cache-name>. Could not export snapshot to bucket '%s'.  | 
|  Snapshot copy failed  |  Snapshot arn-1 Snapshot arn-2  |  failure  |  serverless-cache-snapshot  |  Failed to copy snapshot <snapshot-name>. Could not copy snapshot '%s' to snapshot '%s' with source snapshot Customer Managed Key <key-id> <reason-name>.  | 
|  Snapshot copy failed  |  Snapshot arn-1 Snapshot arn-2  |  failure  |  serverless-cache-snapshot  |  Failed to copy snapshot <snapshot-name>. Could not copy snapshot '%s' to snapshot '%s' with target snapshot Customer Managed Key '%s' '%s'.  | 

# Metrics and events for node-based Valkey and Redis OSS clusters
Metrics and events for node-based Valkey and Redis OSS clusters

ElastiCache offers a wide variety of metrics and events for monitoring node-based Valkey and Redis OSS clusters. This includes host-level metrics, command level metrics, and event logs available via the AWS CLI and the Amazon Simple Notification Service (SNS).

**Topics**
+ [

## Metrics for node-based clusters
](#self-designed-metrics.redis)
+ [

## Events for node-based clusters (Valkey and Redis OSS)
](#self-designed-events-redis)

## Metrics for node-based clusters
Node-based cluster metrics

When you create a node-based cluster, ElastiCache emits metrics at each node level, including both host-level metrics and cache metrics. 

For more information on host-level metrics, see [Host-Level Metrics](CacheMetrics.HostLevel.md).

For more information on node-level metrics, see [Metrics for Valkey and Redis OSS](CacheMetrics.Redis.md).

## Events for node-based clusters (Valkey and Redis OSS)
Node-based cluster events (Valkey and Redis OSS)

ElastiCache logs events that relate to your node-based clusters. When working with node-based clusters, you can view your cluster events in the ElastiCache console, using the AWS CLI, or using Amazon Simple Notification Service (SNS). Node-based cluster events are not published to Amazon EventBridge.

Node-based cluster event information includes the date and time of the event, the source name and source type of the event, and a description of the event. You can easily retrieve events from the log using the ElastiCache console, the AWS CLI describe-events command, or the ElastiCache API action DescribeEvents. 

Viewing ElastiCache events (Console)

The following procedure displays events using the ElastiCache console.

To view events using the ElastiCache console

1. Sign in to the AWS Management Console and open the ElastiCache console at [https://console.aws.amazon.com/elasticache/](https://console.aws.amazon.com/elasticache/)

1. To see a list of all available events, in the navigation pane, choose Events. 

1. On the Events screen each row of the list represents one event and displays the event source, the event type, the GMT time of the event, and a description of the event. Using the Filter you can specify whether you want to see all events, or just events of a specific type in the event list.

Viewing ElastiCache events (AWS CLI)

To generate a list of ElastiCache events using the AWS CLI, use the command describe-events. You can use optional parameters to control the type of events listed, the time frame of the events listed, the maximum number of events to list, and more.

The following code lists up to 40 node-based cluster events.

```
aws elasticache describe-events --source-type cache-cluster --max-items 40  
```

The following code lists all events for node-based caches for the past 24 hours (1440 minutes).

```
aws elasticache describe-events --source-type cache-cluster --duration 1440 
```

Node-based cluster events

This section contains the list of events you can expect to receive for your node-based clusters.

The following ElastiCache events trigger Amazon SNS notifications. For information on event details, see [Viewing ElastiCache events](ECEvents.Viewing.md).


| Event Name | Message | Description | 
| --- | --- | --- | 
|  ElastiCache:AddCacheNodeComplete  |  ElastiCache:AddCacheNodeComplete : cache-cluster  |  A cache node has been added to the cluster and is ready for use.  | 
|  ElastiCache:AddCacheNodeFailed due to insufficient free IP addresses  |  ElastiCache:AddCacheNodeFailed : cluster-name  |  A cache node could not be added because there are not enough available IP addresses.  | 
|  ElastiCache:CacheClusterParametersChanged  |  ElastiCache:CacheClusterParametersChanged : cluster-name  |  One or more cluster parameters have been changed.  | 
|  ElastiCache:CacheClusterProvisioningComplete  |  ElastiCache:CacheClusterProvisioningComplete cluster-name-0001-005  |  The provisioning of a cluster is completed, and the cache nodes in the cache cluster are ready to use.  | 
|  ElastiCache:CacheClusterProvisioningFailed due to incompatible network state  |  ElastiCache:CacheClusterProvisioningFailed : cluster-name  |  An attempt was made to launch a new cluster into a nonexistent virtual private cloud (VPC).  | 
| ElastiCache:CacheClusterScalingComplete  | `CacheClusterScalingComplete : cluster-name` | Scaling for cache-cluster completed successfully. | 
| ElastiCache:CacheClusterScalingFailed | ElastiCache:CacheClusterScalingFailed : *cluster-name* | Scale-up operation on cache-cluster failed.  | 
|  ElastiCache:CacheClusterSecurityGroupModified  |  ElastiCache:CacheClusterSecurityGroupModified : cluster-name  |  One of the following events has occurred: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/AmazonElastiCache/latest/dg/self-designed-metrics-events.valkey-and-redis.html)  | 
|  ElastiCache:CacheNodeReplaceStarted  |  ElastiCache:CacheNodeReplaceStarted : cluster-name  |  ElastiCache has detected that the host running a cache node is degraded or unreachable and has started replacing the cache node.  The DNS entry for the replaced cache node is not changed.  In most instances, you do not need to refresh the server-list for your clients when this event occurs. However, some cache client libraries may stop using the cache node even after ElastiCache has replaced the cache node; in this case, the application should refresh the server-list when this event occurs.  | 
|  ElastiCache:CacheNodeReplaceComplete  |  ElastiCache:CacheNodeReplaceComplete : cluster-name  |  ElastiCache has detected that the host running a cache node is degraded or unreachable and has completed replacing the cache node.  The DNS entry for the replaced cache node is not changed.  In most instances, you do not need to refresh the server-list for your clients when this event occurs. However, some cache client libraries may stop using the cache node even after ElastiCache has replaced the cache node; in this case, the application should refresh the server-list when this event occurs.  | 
|  ElastiCache:CacheNodesRebooted  |  ElastiCache:CacheNodesRebooted : cluster-name  |  One or more cache nodes has been rebooted. Message (Memcached): `"Cache node %s shutdown"` Then a second message: `"Cache node %s restarted"`  | 
|  ElastiCache:CertificateRenewalComplete (Valkey or Redis OSS only)  |  ElastiCache:CertificateRenewalComplete  |  The Amazon CA certificate was successfully renewed.  | 
|  ElastiCache:CreateReplicationGroupComplete  |  ElastiCache:CreateReplicationGroupComplete : cluster-name  |  The replication group was successfully created.  | 
|  ElastiCache:DeleteCacheClusterComplete  |  ElastiCache:DeleteCacheClusterComplete : cluster-name  |  The deletion of a cluster and all associated cache nodes has completed.  | 
| ElastiCache:FailoverComplete (Valkey or Redis OSS only) | `ElastiCache:FailoverComplete : mycluster` | Failover over to a replica node was successful.  | 
|  ElastiCache:ReplicationGroupIncreaseReplicaCountFinished  |  ElastiCache:ReplicationGroupIncreaseReplicaCountFinished : cluster-name-0001-005  |  The number of replicas in the cluster has been increased.   | 
|  ElastiCache:ReplicationGroupIncreaseReplicaCountStarted  |  ElastiCache:ReplicationGroupIncreaseReplicaCountStarted : cluster-name-0003-004  |  The process of adding replicas to your cluster has begun.   | 
|  ElastiCache:NodeReplacementCanceled  |  ElastiCache:NodeReplacementCanceled : cluster-name  |  A node in your cluster that was scheduled for replacement is no longer scheduled for replacement.   | 
|  ElastiCache:NodeReplacementRescheduled  |  ElastiCache:NodeReplacementRescheduled : cluster-name  |  A node in your cluster previously scheduled for replacement has been rescheduled for replacement during the new window described in the notification.  For information on what actions you can take, see [Replacing nodes (Valkey and Redis OSS)](CacheNodes.NodeReplacement.md).  | 
|  ElastiCache:NodeReplacementScheduled  |  ElastiCache:NodeReplacementScheduled : cluster-name  |  A node in your cluster is scheduled for replacement during the window described in the notification.  For information on what actions you can take, see [Replacing nodes (Valkey and Redis OSS)](CacheNodes.NodeReplacement.md).  | 
|  ElastiCache:RemoveCacheNodeComplete  |  ElastiCache:RemoveCacheNodeComplete : cluster-name  |  A cache node has been removed from the cluster.  | 
| ElastiCache:ReplicationGroupScalingComplete | `ElastiCache:ReplicationGroupScalingComplete : cluster-name` | Scale-up operation on replication group completed successfully.  | 
| ElastiCache:ReplicationGroupScalingFailed | `"Failed applying modification to cache node type to %s."` | Scale-up operation on replication group failed.  | 
| ElastiCache:ServiceUpdateAvailableForNode | `"Service update is available for cache node %s."` | A self-service update is available for the node.  | 
|  ElastiCache:SnapshotComplete (Valkey or Redis OSS only)  |  ElastiCache:SnapshotComplete : cluster-name  |  A cache snapshot has completed successfully.  | 
|  ElastiCache:SnapshotFailed (Valkey or Redis OSS only)  |  SnapshotFailed : cluster-name  |  A cache snapshot has failed. See the cluster’s cache events for more a detailed cause. If you describe the snapshot, see [https://docs.aws.amazon.com/AmazonElastiCache/latest/APIReference/API_DescribeSnapshots.html](https://docs.aws.amazon.com/AmazonElastiCache/latest/APIReference/API_DescribeSnapshots.html), the status will be `failed`.  | 

# Metrics and events for Memcached caches and clusters
Metrics and events for Memcached

This section describes the metrics and events that you can monitor when working with Memcached node-based and serverless caches.

**Topics**
+ [

## Metrics for ElastiCache Serverless for Memcached
](#serverless-metrics-memcached)
+ [

## Events for ElastiCache Serverless for Memcached
](#serverless-events.memcached)
+ [

## Metrics for node-based Memcached clusters
](#node-based-metrics-memcached)
+ [

## Events for node-based Memcached clusters
](#node-based-events-memcached)

## Metrics for ElastiCache Serverless for Memcached
Memcached serverless metrics

This section describes the metrics and events that you can monitor when working with ElastiCache Serverless for Memcached.

The `AWS/ElastiCache` namespace includes the following CloudWatch metrics for your Memcached serverless caches.


| Metric | Description | Unit | 
| --- | --- | --- | 
|  BytesUsedForCache  |  The total number of bytes used by the data stored in your cache.  |  Bytes  | 
|  ElastiCacheProcessingUnits  |  The total number of ElastiCacheProcessingUnits (ECPUs) consumed by the requests executed on your cache  |  Count  | 
|  SuccessfulReadRequestLatency  |  Latency of successful read requests.  |  Microseconds  | 
|  SuccessfulWriteRequestLatency  |  Latency of successful write requests  |  Microseconds  | 
|  TotalCmdsCount  |  Total count of all commands executed on your cache  |  Count  | 
|  CurrConnections  |  The number of client connections to your cache.  |  Count  | 
|  ThrottledCmds  |  The number of requests that were throttled by ElastiCache because the workload was scaling faster than ElastiCache can scale.  |  Count  | 
|  NewConnections  |  The total number of connections that have been accepted by the server during this period.  |  Count  | 
|  CurrItems  |  The number of items in the cache.  |  Count  | 
|  NetworkBytesIn  |  Total bytes transferred in to cache  |  Bytes  | 
|  NetworkBytesOut  |  Total bytes transferred out of cache  |  Bytes  | 
|  Evictions  |  The count of keys evicted by the cache  |  Count  | 
|  Reclaimed  |  The number of keys expired by the cache  |  Count  | 

**Command level metrics**

ElastiCache also emits the following Memcached command level metrics


| Metric | Description | Unit | 
| --- | --- | --- | 
|  CmdGet  |  The number of get commands the cache has received.  |  Count  | 
|  CmdSet  |  The number of set commands the cache has received.  |  Count  | 
|  CmdTouch  |  The number of touch commands the cache has received.  |  Count  | 
|  GetHits  |  The number of get requests the cache has received where the key requested was found.  |  Count  | 
|  GetMisses  |  The number of get requests the cache has received where the key requested was not found.  |  Count  | 
|  IncrHits  |  The number of increment requests the cache has received where the key requested was found.  |  Count  | 
|  IncrMisses  |  The number of increment requests the cache has received where the key requested was not found.  |  Count  | 
|  DecrHits  |  The number of decrement requests the cache has received where the requested key was found.  |  Count  | 
|  DecrMisses  |  The number of decrement requests the cache has received where the requested key was not found.  |  Count  | 
|  DeleteHits  |  The number of delete requests the cache has received where the requested key was found.  |  Count  | 
|  DeleteMisses  |  The number of delete requests the cache has received where the requested key was not found.  |  Count  | 
|  TouchHits  |  The number of keys that have been touched and were given a new expiration time.  |  Count  | 
|  TouchMisses  |  The number of keys that have been touched, but were not found.  |  Count  | 
|  CasHits  |  The number of cas requests the cache has received where the requested key was found and the cas value matched.  |  Count  | 
|  CasMisses  |  The number of cas requests the cache has received where the key requested was not found.  |  Count  | 
|  CasBadval  |  The number of cas requests the cache has received where the cas value did not match the cas value stored.  |  Count  | 
|  CmdFlush  |  The number of flush commands the cache has received.  |  Count  | 

## Events for ElastiCache Serverless for Memcached
Memcached serverless events

ElastiCache logs events that relate to your serverless cache. This information includes the date and time of the event, the source name and source type of the event, and a description of the event. You can easily retrieve events from the log using the ElastiCache console, the AWS CLI describe-events command, or the ElastiCache API action `DescribeEvents`.

You can choose to monitor, ingest, transform, and act on ElastiCache events using Amazon EventBridge. Learn more in the Amazon EventBridge [getting started guide](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-get-started.html).

**Viewing ElastiCache events (Console)**

To view events using the ElastiCache console:

1. Sign in to the AWS Management Console and open the ElastiCache console at [https://console.aws.amazon.com/elasticache/](https://console.aws.amazon.com/elasticache/)

1. To see a list of all available events, in the navigation pane, choose **Events**. 

1. On the *Events *screen each row of the list represents one event and displays the event source, the event type, the GMT time of the event, and a description of the event. Using the **Filter** you can specify whether you want to see all events, or just events of a specific type in the event list.

**Viewing ElastiCache events (AWS CLI)**

To generate a list of ElastiCache events using the AWS CLI, use the command describe-events. You can use optional parameters to control the type of events listed, the time frame of the events listed, the maximum number of events to list, and more.

The following code lists up to 40 serverless cache events.

```
aws elasticache describe-events --source-type serverless-cache --max-items 40
```

The following code lists all events for serverless caches for the past 24 hours (1440 minutes).

```
aws elasticache describe-events --source-type serverless-cache --duration 1440
```

**Serverless Events**

This section documents the different types of events that you may receive for your serverless caches. 

**Serverless Cache Creation Events**


| Detail-Type | Description | Unit | Source | Message | 
| --- | --- | --- | --- | --- | 
|  Cache created  |  Cache arn  |  creation  |  serverless-cache  |  Cache <cache-name> is created and ready to use.  | 
|  Cache creation failed  |  Cache arn  |  failure  |  serverless-cache  |  Failed to create cache <cache-name>. Insufficient free IP addresses to create VPC endpoint.  | 
|  Cache creation failed  |  Cache arn  |  failure  |  serverless-cache  |  Failed to create cache <cache-name>. Invalid subnets provided in the request.  | 
|  Cache creation failed  |  Cache arn  |  failure  |  serverless-cache  |  Failed to create cache <cache-name>. Quota limit reached for creating VPC endpoint.  | 
|  Cache creation failed  |  Cache arn  |  failure  |  serverless-cache  |  Failed to create cache <cache-name>. You do not have permissions to create a VPC endpoint.  | 

**Serverless Cache Update Events (Memcached)**


| Detail-Type | Resources list | Category | Source | Message | 
| --- | --- | --- | --- | --- | 
|  Cache updated  |  Cache arn  |  configuration change  |  serverless-cache  |  SecurityGroups updated for the cache <cache-name>.  | 
|  Cache updated  |  Cache arn  |  configuration change  |  serverless-cache  |  Tags updated for the cache <cache-name>.  | 
|  Cache updated failed  |  Cache arn  |  configuration change  |  serverless-cache  |  An update to the cache <cache-name> failed. SecurityGroups update failed.  | 
|  Cache updated failed  |  Cache arn  |  configuration change  |  serverless-cache  |  An update to the cache <cache-name> failed. SecurityGroups update failed because of insufficient permissions.  | 
|  Cache updated failed  |  Cache arn  |  configuration change  |  serverless-cache  |  An update to the cache <cache-name> failed. SecurityGroups update failed because the SecurityGroups are invalid.  | 

**Serverless Cache Deletion Events (Memcached)**


| Detail-Type | Resources list | Category | Source | Message | 
| --- | --- | --- | --- | --- | 
|  Cache deleted  |  Cache arn  |  deletion  |  serverless-cache  |  Cache <cache-name> was deleted.  | 

**Serverless Cache Usage Limit Events (Memcached)**


| Detail-Type | Description | Unit | Source | Message | 
| --- | --- | --- | --- | --- | 
|  Cache updated  |  Cache arn  |  configuration change  |  serverless-cache  |  Limits updated for the cache <cache-name>.  | 
|  Cache updated failed  |  Cache arn  |  failure  |  serverless-cache  |  A limit update to the cache <cache-name> failed because the cache was deleted.  | 
|  Cache updated failed  |  Cache arn  |  failure  |  serverless-cache  |  A limit update to the cache <cache-name> failed due to invalid configuration.  | 

**Serverless Cache Snapshot Events (Memcached)**


| Detail-Type | Resources-list | Category | Source | Message | 
| --- | --- | --- | --- | --- | 
|  Snapshot created  |  Cache arn Snapshot arn  |  creation  |  serverless-cache-snapshot  |  Snapshot <snapshot-name> created for cache <cache-name>.  | 
|  Snapshot creation failed  |  Cache arn Snapshot arn  |  failure  |  serverless-cache-snapshot  |  Failed to create snapshot for cache <cache-name>. Snapshot <snapshot-name> creation failed with Customer Managed Key <key-id> <reason>. Failure reason messages: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/AmazonElastiCache/latest/dg/serverless-metrics-events.memcached.html)  | 
|  Snapshot creation failed  |  Cache arn Snapshot arn  |  failure  |  serverless-cache-snapshot  |  Failed to create snapshot for cache <cache-name>. Snapshot <snapshot-name> creation failed because <reason>. Default reason: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/AmazonElastiCache/latest/dg/serverless-metrics-events.memcached.html)  | 
|  Snapshot export failed  |  Snapshot arn  |  failure  |  serverless-cache-snapshot  |  Failed to export snapshot for cache <cache-name>. Could not export snapshot to bucket %s because ElastiCache does not have permissions to the bucket.  | 
|  Snapshot export failed  |  Snapshot arn  |  failure  |  serverless-cache-snapshot  |  Failed to export snapshot for cache <cache-name>. Could not export snapshot to bucket '%s' because there is already an object with the same name in the bucket.  | 
|  Snapshot export failed  |  Snapshot arn  |  failure  |  serverless-cache-snapshot  |  Failed to export snapshot for cache <cache-name>. Could not export snapshot to bucket '%s' because bucket owner account Id has changed.  | 
|  Snapshot export failed  |  Snapshot arn  |  failure  |  serverless-cache-snapshot  |  Failed to export snapshot for cache <cache-name>. Could not export snapshot to bucket '%s' because the S3 bucket is not accessible.  | 
|  Snapshot export failed  |  Snapshot arn  |  failure  |  serverless-cache-snapshot  |  Failed to export snapshot for cache <cache-name>. Could not export snapshot to bucket '%s' because the bucket is not accessible.  | 
|  Snapshot export failed  |  Snapshot arn  |  failure  |  serverless-cache-snapshot  |  Failed to export snapshot for cache <cache-name>. Could not export snapshot to bucket '%s' because bucket does not exist.  | 
|  Snapshot export failed  |  Snapshot arn  |  failure  |  serverless-cache-snapshot  |  Failed to export snapshot for cache <cache-name>. Could not export snapshot to bucket '%s' with source snapshot Customer Managed Key %s <reason>.  | 
|  Snapshot export failed  |  Snapshot arn  |  failure  |  serverless-cache-snapshot  |  Failed to export snapshot for cache <cache-name>. Could not export snapshot to bucket '%s'.  | 
|  Snapshot copy failed  |  Snapshot arn-1 Snapshot arn-2  |  failure  |  serverless-cache-snapshot  |  Failed to copy snapshot <snapshot-name>. Could not copy snapshot '%s' to snapshot '%s' with source snapshot Customer Managed Key <key-id> <reason-name>.  | 
|  Snapshot copy failed  |  Snapshot arn-1 Snapshot arn-2  |  failure  |  serverless-cache-snapshot  |  Failed to copy snapshot <snapshot-name>. Could not copy snapshot '%s' to snapshot '%s' with target snapshot Customer Managed Key '%s' '%s'.  | 

## Metrics for node-based Memcached clusters
Node-based Memcached metrics

This section describes the CloudWatch metrics that you can monitor when working with node-based Memcached clusters. These metrics are measured per cache node in 60-second intervals.

**Host-level metrics**


| Metric | Description | Unit | 
| --- | --- | --- | 
|  `CPUUtilization`  |  Percentage of CPU utilization for the entire host. Because Memcached is multi-threaded, this metric can be as high as 90%. If you exceed this threshold, scale your cluster up by using a larger cache node type, or scale out by adding more cache nodes.  |  Percent  | 
|  `FreeableMemory`  |  Amount of free memory available on the host, derived from RAM, buffers, and cache that the OS reports as freeable.  |  Bytes  | 
|  `NetworkBytesIn`  |  Number of bytes the host has read from the network.  |  Bytes  | 
|  `NetworkBytesOut`  |  Number of bytes sent out on all network interfaces by the instance.  |  Bytes  | 
|  `NetworkPacketsIn`  |  Number of packets received on all network interfaces by the instance.  |  Count  | 
|  `NetworkPacketsOut`  |  Number of packets sent out on all network interfaces by the instance.  |  Count  | 
|  `SwapUsage`  |  Amount of swap used on the host.  |  Bytes  | 

**Memcached metrics**


| Metric | Description | Unit | 
| --- | --- | --- | 
|  `BytesReadIntoMemcached`  |  Number of bytes read from the network by the cache node.  |  Bytes  | 
|  `BytesUsedForCacheItems`  |  Number of bytes used to store cache items.  |  Bytes  | 
|  `BytesWrittenOutFromMemcached`  |  Number of bytes written to the network by the cache node.  |  Bytes  | 
|  `CasBadval`  |  Number of CAS requests where the Cas value did not match.  |  Count  | 
|  `CasHits`  |  Number of Cas requests where the key was found and the Cas value matched.  |  Count  | 
|  `CasMisses`  |  Number of Cas requests where the key was not found.  |  Count  | 
|  `CmdFlush`  |  Number of flush commands received.  |  Count  | 
|  `CmdGet`  |  Number of get commands received.  |  Count  | 
|  `CmdSet`  |  Number of set commands received.  |  Count  | 
|  `CurrConnections`  |  Number of connections connected to the cache at an instant in time.  |  Count  | 
|  `CurrItems`  |  Number of items currently stored in the cache.  |  Count  | 
|  `DecrHits`  |  Number of decrement requests where the key was found.  |  Count  | 
|  `DecrMisses`  |  Number of decrement requests where the key was not found.  |  Count  | 
|  `DeleteHits`  |  Number of delete requests where the key was found.  |  Count  | 
|  `DeleteMisses`  |  Number of delete requests where the key was not found.  |  Count  | 
|  `Evictions`  |  Number of non-expired items evicted to allow space for new writes.  |  Count  | 
|  `GetHits`  |  Number of get requests where the key was found.  |  Count  | 
|  `GetMisses`  |  Number of get requests where the key was not found.  |  Count  | 
|  `IncrHits`  |  Number of increment requests where the key was found.  |  Count  | 
|  `IncrMisses`  |  Number of increment requests where the key was not found.  |  Count  | 
|  `NewConnections`  |  Number of new connections the cache has received.  |  Count  | 
|  `NewItems`  |  Number of new items the cache has stored.  |  Count  | 
|  `Reclaimed`  |  Number of expired items evicted to allow space for new writes.  |  Count  | 
|  `UnusedMemory`  |  Amount of memory not used by data.  |  Bytes  | 

## Events for node-based Memcached clusters
Node-based Memcached events

ElastiCache sends notifications for significant cluster events using Amazon Simple Notification Service. You can monitor events using the ElastiCache console, the AWS CLI `describe-events` command, or the ElastiCache API `DescribeEvents` action.

To view events using the AWS CLI, use the `--source-type cache-cluster` parameter.

The following examples show how to use the AWS CLI to list cache cluster events:

List up to 40 cache cluster events:

```
aws elasticache describe-events --source-type cache-cluster --max-items 40
```

List cache cluster events for the past 24 hours:

```
aws elasticache describe-events --source-type cache-cluster --duration 1440
```

For more information about managing Amazon SNS notifications for events, see the Amazon SNS event monitoring topic.

# Logging Amazon ElastiCache API calls with AWS CloudTrail


Amazon ElastiCache is integrated with AWS CloudTrail, a service that provides a record of actions taken by a user, role, or an AWS service in Amazon ElastiCache. CloudTrail captures all API calls for Amazon ElastiCache as events, including calls from the Amazon ElastiCache console and from code calls to the Amazon ElastiCache API operations. If you create a trail, you can enable continuous delivery of CloudTrail events to an Amazon S3 bucket, including events for Amazon ElastiCache. If you don't configure a trail, you can still view the most recent events in the CloudTrail console in **Event history**. Using the information collected by CloudTrail, you can determine the request that was made to Amazon ElastiCache, the IP address from which the request was made, who made the request, when it was made, and additional details. 

To learn more about CloudTrail, see the [AWS CloudTrail User Guide](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/).

## Amazon ElastiCache information in CloudTrail


CloudTrail is enabled on your AWS account when you create the account. When activity occurs in Amazon ElastiCache, that activity is recorded in a CloudTrail event along with other AWS service events in **Event history**. You can view, search, and download recent events in your AWS account. For more information, see [Viewing Events with CloudTrail Event History](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/view-cloudtrail-events.html). 

For an ongoing record of events in your AWS account, including events for Amazon ElastiCache, create a trail. A trail enables CloudTrail to deliver log files to an Amazon S3 bucket. By default, when you create a trail in the console, the trail applies to all regions. The trail logs events from all regions in the AWS partition and delivers the log files to the Amazon S3 bucket that you specify. Additionally, you can configure other AWS services to further analyze and act upon the event data collected in CloudTrail logs. For more information, see the following: 
+ [Overview for Creating a Trail](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-create-and-update-a-trail.html)
+ [CloudTrail Supported Services and Integrations](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-aws-service-specific-topics.html#cloudtrail-aws-service-specific-topics-integrations)
+ [Configuring Amazon SNS Notifications for CloudTrail](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/getting_notifications_top_level.html)
+ [Receiving CloudTrail Log Files from Multiple Regions](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/receive-cloudtrail-log-files-from-multiple-regions.html) and [Receiving CloudTrail Log Files from Multiple Accounts](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-receive-logs-from-multiple-accounts.html)

All Amazon ElastiCache actions are logged by CloudTrail and are documented in the [ElastiCache API Reference](https://docs.aws.amazon.com/AmazonElastiCache/latest/APIReference/). For example, calls to the `CreateCacheCluster`, `DescribeCacheCluster` and `ModifyCacheCluster` actions generate entries in the CloudTrail log files. 

Every event or log entry contains information about who generated the request. The identity information helps you determine the following: 
+ Whether the request was made with root or IAM user credentials.
+ Whether the request was made with temporary security credentials for a role or federated user.
+ Whether the request was made by another AWS service.

For more information, see the [CloudTrail userIdentity Element](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-event-reference-user-identity.html).

## Understanding Amazon ElastiCache log file entries


A trail is a configuration that enables delivery of events as log files to an Amazon S3 bucket that you specify. CloudTrail log files contain one or more log entries. An event represents a single request from any source and includes information about the requested action, the date and time of the action, request parameters, and so on. CloudTrail log files are not an ordered stack trace of the public API calls, so they do not appear in any specific order. 

The following example shows a CloudTrail log entry that demonstrates the `CreateCacheCluster` action.

```
{ 
    "eventVersion":"1.01",
    "userIdentity":{
        "type":"IAMUser",
        "principalId":"EXAMPLEEXAMPLEEXAMPLE",
        "arn":"arn:aws:iam::123456789012:user/elasticache-allow",
        "accountId":"123456789012",
        "accessKeyId":"AKIAIOSFODNN7EXAMPLE",
        "userName":"elasticache-allow"
    },
    "eventTime":"2014-12-01T22:00:35Z",
    "eventSource":"elasticache.amazonaws.com",
    "eventName":"CreateCacheCluster",
    "awsRegion":"us-west-2",
    "sourceIPAddress":"192.0.2.01",
    "userAgent":"AWS CLI/ElastiCache 1.10 API 2014-12-01",
    "requestParameters":{
        "numCacheNodes":2,
        "cacheClusterId":"test-memcached",
        "engine":"memcached",
        "aZMode":"cross-az",
        "cacheNodeType":"cache.m1.small",
       
    },
    "responseElements":{
        "engine":"memcached",
        "clientDownloadLandingPage":"https://console.aws.amazon.com/elasticache/home#client-download:",
        "cacheParameterGroup":{
            "cacheParameterGroupName":"default.memcached1.4",
            "cacheNodeIdsToReboot":{
            },
            "parameterApplyStatus":"in-sync"
        },
        "preferredAvailabilityZone":"Multiple",
        "numCacheNodes":2,
        "cacheNodeType":"cache.m1.small",
      
        "cacheClusterStatus":"creating",
        "autoMinorVersionUpgrade":true,
        "preferredMaintenanceWindow":"thu:05:00-thu:06:00",
        "cacheClusterId":"test-memcached",
        "engineVersion":"1.4.14",
        "cacheSecurityGroups":[
            {
                "status":"active",
                "cacheSecurityGroupName":"default"
            }
        ],
        "pendingModifiedValues":{
        }
    },
    "requestID":"104f30b3-3548-11e4-b7b8-6d79ffe84edd",
    "eventID":"92762127-7a68-42ce-8787-927d2174cde1" 
}
```

The following example shows a CloudTrail log entry that demonstrates the `DescribeCacheCluster` action. Note that for all Amazon ElastiCache Describe calls (`Describe*`), the `ResponseElements` section is removed and appears as `null`. 

```
{ 
    "eventVersion":"1.01",
    "userIdentity":{
        "type":"IAMUser",
        "principalId":"EXAMPLEEXAMPLEEXAMPLE",
        "arn":"arn:aws:iam::123456789012:user/elasticache-allow",
        "accountId":"123456789012",
        "accessKeyId":"AKIAIOSFODNN7EXAMPLE",
        "userName":"elasticache-allow"
    },
    "eventTime":"2014-12-01T22:01:00Z",
    "eventSource":"elasticache.amazonaws.com",
    "eventName":"DescribeCacheClusters",
    "awsRegion":"us-west-2",
    "sourceIPAddress":"192.0.2.01",
    "userAgent":"AWS CLI/ElastiCache 1.10 API 2014-12-01",
    "requestParameters":{
        "showCacheNodeInfo":false,
        "maxRecords":100
    },
    "responseElements":null,
    "requestID":"1f0b5031-3548-11e4-9376-c1d979ba565a",
    "eventID":"a58572a8-e81b-4100-8e00-1797ed19d172"
}
```

The following example shows a CloudTrail log entry that records a `ModifyCacheCluster` action. 

```
{ 
    "eventVersion":"1.01",
    "userIdentity":{
        "type":"IAMUser",
        "principalId":"EXAMPLEEXAMPLEEXAMPLE",
        "arn":"arn:aws:iam::123456789012:user/elasticache-allow",
        "accountId":"123456789012",
        "accessKeyId":"AKIAIOSFODNN7EXAMPLE",
        "userName":"elasticache-allow"
    },
    "eventTime":"2014-12-01T22:32:21Z",
    "eventSource":"elasticache.amazonaws.com",
    "eventName":"ModifyCacheCluster",
    "awsRegion":"us-west-2",
    "sourceIPAddress":"192.0.2.01",
    "userAgent":"AWS CLI/ElastiCache 1.10 API 2014-12-01",
    "requestParameters":{
        "applyImmediately":true,
        "numCacheNodes":3,
        "cacheClusterId":"test-memcached"
    },
    "responseElements":{
        "engine":"memcached",
        "clientDownloadLandingPage":"https://console.aws.amazon.com/elasticache/home#client-download:",
        "cacheParameterGroup":{
            "cacheParameterGroupName":"default.memcached1.4",
            "cacheNodeIdsToReboot":{
            },
            "parameterApplyStatus":"in-sync"
        },
        "cacheClusterCreateTime":"Dec 1, 2014 10:16:06 PM",
        "preferredAvailabilityZone":"Multiple",
        "numCacheNodes":2,
        "cacheNodeType":"cache.m1.small",
        "cacheClusterStatus":"modifying",
        "autoMinorVersionUpgrade":true,
        "preferredMaintenanceWindow":"thu:05:00-thu:06:00",
        "cacheClusterId":"test-memcached",
        "engineVersion":"1.4.14",
        "cacheSecurityGroups":[
            {
                "status":"active",
                "cacheSecurityGroupName":"default"
            }
        ],
        "configurationEndpoint":{
            "address":"test-memcached.example.cfg.use1prod.cache.amazonaws.com",
            "port":11211
        },
        "pendingModifiedValues":{
            "numCacheNodes":3
        }
    },
    "requestID":"807f4bc3-354c-11e4-9376-c1d979ba565a",
    "eventID":"e9163565-376f-4223-96e9-9f50528da645"
}
```

# Amazon SNS monitoring of ElastiCache events
Amazon SNS event monitoring

When significant events happen for a cluster, ElastiCache sends notification to a specific Amazon SNS topic. Examples include a failure to add a node, success in adding a node, the modification of a security group, and others. By monitoring for key events, you can know the current state of your clusters and, depending upon the event, be able to take corrective action.

**Topics**
+ [

# Managing ElastiCache Amazon SNS notifications
](ECEvents.SNS.md)
+ [

# Viewing ElastiCache events
](ECEvents.Viewing.md)
+ [

# Event Notifications and Amazon SNS
](ElastiCacheSNS.md)

# Managing ElastiCache Amazon SNS notifications


You can configure ElastiCache to send notifications for important cluster events using Amazon Simple Notification Service (Amazon SNS). In these examples, you will configure a cluster with the Amazon Resource Name (ARN) of an Amazon SNS topic to receive notifications. 

**Note**  
This topic assumes that you've signed up for Amazon SNS and have set up and subscribed to an Amazon SNS topic. For information on how to do this, see the [Amazon Simple Notification Service Developer Guide](https://docs.aws.amazon.com/sns/latest/dg/). 
By default, the `API modify-replication-group` affects all groups in a Region and not just the current specified group. If you want to configure one specific group in a Region differently than the other groups, you can use the `--notification-topic-arn` option to create a separate topic for that group.

## Adding an Amazon SNS topic


The following sections show you how to add an Amazon SNS topic using the AWS Console, the AWS CLI, or the ElastiCache API.

### Adding an Amazon SNS topic (Console)


 The following procedure shows you how to add an Amazon SNS topic for a cluster. When using Valkey or Redis OSS to add an Amazon SNS topic for a replication group in step 2, instead of choosing a cluster, choose a replication group. Then follow the same remaining steps.

**Note**  
 This process can also be used to modify the Amazon SNS topic. 

**To add or modify an Amazon SNS topic for a cluster (Console)**

1. Sign in to the AWS Management Console and open the ElastiCache console at [ https://console.aws.amazon.com/elasticache/](https://console.aws.amazon.com/elasticache/).

1. In ** Clusters**, choose the cluster for which you want to add or modify an Amazon SNS topic ARN.

1. Choose **Modify**.

1. In **Modify Cluster** under **Topic for SNS Notification**, choose the SNS topic you want to add, or choose **Manual ARN input** and type the ARN of the Amazon SNS topic. 

1. Choose **Modify**.

### Adding an Amazon SNS topic (AWS CLI)


To add or modify an Amazon SNS topic for a cluster, use the AWS CLI command `modify-cache-cluster`.

The following code example adds an Amazon SNS topic arn to *my-cluster*.

For Linux, macOS, or Unix:

```
aws elasticache modify-cache-cluster \
    --cache-cluster-id my-cluster \
    --notification-topic-arn arn:aws:sns:us-west-2:123456789xxx:ElastiCacheNotifications
```

For Windows:

```
aws elasticache modify-cache-cluster ^
    --cache-cluster-id my-cluster ^
    --notification-topic-arn arn:aws:sns:us-west-2:123456789xx:ElastiCacheNotifications
```

For more information, see [modify-cache-cluster](https://docs.aws.amazon.com/cli/latest/reference/elasticache/modify-cache-cluster.html).

### Adding an Amazon SNS topic (ElastiCache API)


To add or modify an Amazon SNS topic for a cluster, call the `ModifyCacheCluster` action with the following parameters:
+ `CacheClusterId``=my-cluster`
+ `TopicArn``=arn%3Aaws%3Asns%3Aus-west-2%3A565419523791%3AElastiCacheNotifications`

**Example**  

```
 1. https://elasticache.amazon.com/
 2.     ?Action=ModifyCacheCluster
 3.     &ApplyImmediately=false
 4.     &CacheClusterId=my-cluster
 5.     &NotificationTopicArn=arn%3Aaws%3Asns%3Aus-west-2%3A565419523791%3AElastiCacheNotifications
 6.     &Version=2014-12-01
 7.     &SignatureVersion=4
 8.     &SignatureMethod=HmacSHA256
 9.     &Timestamp=20141201T220302Z
10.     &X-Amz-Algorithm=&AWS;4-HMAC-SHA256
11.     &X-Amz-Date=20141201T220302Z
12.     &X-Amz-SignedHeaders=Host
13.     &X-Amz-Expires=20141201T220302Z
14.     &X-Amz-Credential=<credential>
15.     &X-Amz-Signature=<signature>
```

For more information, see [ModifyCacheCluster](https://docs.aws.amazon.com/AmazonElastiCache/latest/APIReference/API_ModifyCacheCluster.html).

## Enabling and disabling Amazon SNS notifications


 You can turn notifications on or off for a cluster. The following procedures show you how to disable Amazon SNS notifications. 

### Enabling and disabling Amazon SNS notifications (Console)


**To disable Amazon SNS notifications using the AWS Management Console**

1. Sign in to the AWS Management Console and open the ElastiCache console at [ https://console.aws.amazon.com/elasticache/](https://console.aws.amazon.com/elasticache/).

1. To see a list of your clusters running Memcached, in the navigation pane choose **Memcached**.

   To see a list of your clusters running Valkey or Redis OSS, in the navigation pane choose **Valkey** or **Redis OSS**.

1. Choose the box to the left of the cluster you want to modify notification for.

1. Choose **Modify**.

1. In **Modify Cluster** under **Topic for SNS Notification**, choose *Disable Notifications*.

1. Choose **Modify**.

### Enabling and disabling Amazon SNS notifications (AWS CLI)


To disable Amazon SNS notifications, use the command `modify-cache-cluster` with the following parameters:

For Linux, macOS, or Unix:

```
aws elasticache modify-cache-cluster \
    --cache-cluster-id my-cluster \
    --notification-topic-status inactive
```

For Windows:

```
aws elasticache modify-cache-cluster ^
    --cache-cluster-id my-cluster ^
    --notification-topic-status inactive
```

**Note**  
When the cluster belongs to a replication group, you must use the CLI command `modify-replication-group` to enable or disable SNS notifications.

### Enabling and disabling Amazon SNS notifications (ElastiCache API)


To disable Amazon SNS notifications, call the `ModifyCacheCluster` action with the following parameters:
+ `CacheClusterId``=my-cluster`
+ `NotificationTopicStatus``=inactive`

This call returns output similar to the following:

**Example**  

```
 1. https://elasticache.us-west-2.amazonaws.com/
 2.     ?Action=ModifyCacheCluster
 3.     &ApplyImmediately=false
 4.     &CacheClusterId=my-cluster
 5.     &NotificationTopicStatus=inactive
 6.     &Version=2014-12-01
 7.     &SignatureVersion=4
 8.     &SignatureMethod=HmacSHA256
 9.     &Timestamp=20141201T220302Z
10.     &X-Amz-Algorithm=&AWS;4-HMAC-SHA256
11.     &X-Amz-Date=20141201T220302Z
12.     &X-Amz-SignedHeaders=Host
13.     &X-Amz-Expires=20141201T220302Z
14.     &X-Amz-Credential=<credential>
15.     &X-Amz-Signature=<signature>
```

# Viewing ElastiCache events


ElastiCache logs events that relate to your cluster instances, security groups, and parameter groups. This information includes the date and time of the event, the source name and source type of the event, and a description of the event. You can easily retrieve events from the log using the ElastiCache console, the AWS CLI `describe-events` command, or the ElastiCache API action `DescribeEvents`. 

The following procedures show you how to view all ElastiCache events for the past 24 hours (1440 minutes).

## Viewing ElastiCache events (Console)


The following procedure displays events using the ElastiCache console.

**To view events using the ElastiCache console**

1. Sign in to the AWS Management Console and open the ElastiCache console at [ https://console.aws.amazon.com/elasticache/](https://console.aws.amazon.com/elasticache/).

1. To see a list of all available events, in the navigation pane, choose **Events**.

   On the *Events* screen each row of the list represents one event and displays the event source, the event type (cache-cluster, cache-parameter-group, cache-security-group, or cache-subnet-group), the GMT time of the event, and a description of the event.

   Using the **Filter** you can specify whether you want to see all events, or just events of a specific type in the event list.

## Viewing ElastiCache events (AWS CLI)


To generate a list of ElastiCache events using the AWS CLI, use the command `describe-events`. You can use optional parameters to control the type of events listed, the time frame of the events listed, the maximum number of events to list, and more.

The following code lists up to 40 cluster events.

```
aws elasticache describe-events --source-type cache-cluster --max-items 40  
```

The following code lists all events for the past 24 hours (1440 minutes).

```
aws elasticache describe-events --source-type cache-cluster --duration 1440 
```

The output from the `describe-events` command looks something like this.

```
aws elasticache describe-events --source-type cache-cluster --max-items 40  
{
    "Events": [
        {
            "SourceIdentifier": "my-mem-cluster",
            "SourceType": "cache-cluster",
            "Message": "Finished modifying number of nodes from 1 to 3",
            "Date": "2020-06-09T02:01:21.772Z"
        },
        {
            "SourceIdentifier": "my-mem-cluster",
            "SourceType": "cache-cluster",
            "Message": "Added cache node 0002 in availability zone us-west-2a",
            "Date": "2020-06-09T02:01:21.716Z"
        },
        {
            "SourceIdentifier": "my-mem-cluster",
            "SourceType": "cache-cluster",
            "Message": "Added cache node 0003 in availability zone us-west-2a",
            "Date": "2020-06-09T02:01:21.706Z"
        },
        {
            "SourceIdentifier": "my-mem-cluster",
            "SourceType": "cache-cluster",
            "Message": "Increasing number of requested nodes",
            "Date": "2020-06-09T01:58:34.178Z"
        },
        {
            "SourceIdentifier": "mycluster-0003-004",
            "SourceType": "cache-cluster",
            "Message": "Added cache node 0001 in availability zone us-west-2c",
            "Date": "2020-06-09T01:51:14.120Z"
        },
        {
            "SourceIdentifier": "mycluster-0003-004",
            "SourceType": "cache-cluster",
            "Message": "This cluster does not support persistence (ex: 'appendonly').  Please use a different instance type to enable persistence.",
            "Date": "2020-06-09T01:51:14.095Z"
        },
        {
            "SourceIdentifier": "mycluster-0003-004",
            "SourceType": "cache-cluster",
            "Message": "Cache cluster created",
            "Date": "2020-06-09T01:51:14.094Z"
        },
        {
            "SourceIdentifier": "mycluster-0001-005",
            "SourceType": "cache-cluster",
            "Message": "Added cache node 0001 in availability zone us-west-2b",
            "Date": "2020-06-09T01:42:55.603Z"
        },
        {
            "SourceIdentifier": "mycluster-0001-005",
            "SourceType": "cache-cluster",
            "Message": "This cluster does not support persistence (ex: 'appendonly').  Please use a different instance type to enable persistence.",
            "Date": "2020-06-09T01:42:55.576Z"
        },
        {
            "SourceIdentifier": "mycluster-0001-005",
            "SourceType": "cache-cluster",
            "Message": "Cache cluster created",
            "Date": "2020-06-09T01:42:55.574Z"
        },
        {
            "SourceIdentifier": "mycluster-0001-004",
            "SourceType": "cache-cluster",
            "Message": "Added cache node 0001 in availability zone us-west-2b",
            "Date": "2020-06-09T01:28:40.798Z"
        },
        {
            "SourceIdentifier": "mycluster-0001-004",
            "SourceType": "cache-cluster",
            "Message": "This cluster does not support persistence (ex: 'appendonly').  Please use a different instance type to enable persistence.",
            "Date": "2020-06-09T01:28:40.775Z"
        },
        {
            "SourceIdentifier": "mycluster-0001-004",
            "SourceType": "cache-cluster",
            "Message": "Cache cluster created",
            "Date": "2020-06-09T01:28:40.773Z"
        }
    ]
}
```

For more information, such as available parameters and permitted parameter values, see [https://docs.aws.amazon.com/cli/latest/reference/elasticache/describe-events.html](https://docs.aws.amazon.com/cli/latest/reference/elasticache/describe-events.html).

## Viewing ElastiCache events (ElastiCache API)


To generate a list of ElastiCache events using the ElastiCache API, use the `DescribeEvents` action. You can use optional parameters to control the type of events listed, the time frame of the events listed, the maximum number of events to list, and more.

The following code lists the 40 most recent cache-cluster events.

```
https://elasticache.us-west-2.amazonaws.com/
   ?Action=DescribeEvents
   &MaxRecords=40
   &SignatureVersion=4
   &SignatureMethod=HmacSHA256
   &SourceType=cache-cluster
   &Timestamp=20150202T192317Z
   &Version=2015-02-02
   &X-Amz-Credential=<credential>
```

The following code lists the cache-cluster events for the past 24 hours (1440 minutes).

```
https://elasticache.us-west-2.amazonaws.com/
   ?Action=DescribeEvents
   &Duration=1440
   &SignatureVersion=4
   &SignatureMethod=HmacSHA256
   &SourceType=cache-cluster
   &Timestamp=20150202T192317Z
   &Version=2015-02-02
   &X-Amz-Credential=<credential>
```

The above actions should produce output similar to the following.

```
<DescribeEventsResponse xmlns="http://elasticache.amazonaws.com/doc/2015-02-02/"> 
    <DescribeEventsResult> 
        <Events> 
            <Event> 
                <Message>Cache cluster created</Message> 
                <SourceType>cache-cluster</SourceType> 
                <Date>2015-02-02T18:22:18.202Z</Date> 
                <SourceIdentifier>mem01</SourceIdentifier> 
            </Event> 
               
 (...output omitted...)
          
        </Events> 
    </DescribeEventsResult> 
    <ResponseMetadata> 
        <RequestId>e21c81b4-b9cd-11e3-8a16-7978bb24ffdf</RequestId> 
    </ResponseMetadata> 
</DescribeEventsResponse>
```

For more information, such as available parameters and permitted parameter values, see [https://docs.aws.amazon.com/AmazonElastiCache/latest/APIReference/API_DescribeEvents.html](https://docs.aws.amazon.com/AmazonElastiCache/latest/APIReference/API_DescribeEvents.html).

# Event Notifications and Amazon SNS


ElastiCache can publish messages using Amazon Simple Notification Service (SNS) when significant events happen on a cluster. This feature can be used to refresh the server-lists on client machines connected to individual cache node endpoints of a cache cluster.

**Note**  
For more information on Amazon Simple Notification Service (SNS), including information on pricing and links to the Amazon SNS documentation, see the [Amazon SNS product page](https://aws.amazon.com/sns).

Notifications are published to a specified Amazon SNS *topic*. The following are requirements for notifications:
+ Only one topic can be configured for ElastiCache notifications.
+ The AWS account that owns the Amazon SNS topic must be the same account that owns the cluster on which notifications are enabled.
+ The Amazon SNS topic you are publishing to cannot be encrypted.
**Note**  
It is possible to attach an encrypted (at-rest) Amazon SNS topic to the cluster. However, the status of the topic from the ElastiCache console will show as inactive, which effectively disassociates the topic from the cluster when ElastiCache pushes messages to the topic. 
+ The Amazon SNS topic has to be in the same Region as the ElastiCache cluster.

## ElastiCache Events


The following ElastiCache events trigger Amazon SNS notifications. For information on event details, see [Viewing ElastiCache events](ECEvents.Viewing.md).


| Event Name | Message | Description | 
| --- | --- | --- | 
|  ElastiCache:AddCacheNodeComplete  |  ElastiCache:AddCacheNodeComplete : cache-cluster  |  A cache node has been added to the cluster and is ready for use.  | 
|  ElastiCache:AddCacheNodeFailed due to insufficient free IP addresses  |  ElastiCache:AddCacheNodeFailed : cluster-name  |  A cache node could not be added because there are not enough available IP addresses.  | 
|  ElastiCache:CacheClusterParametersChanged  |  ElastiCache:CacheClusterParametersChanged : cluster-name  |  One or more cluster parameters have been changed.  | 
|  ElastiCache:CacheClusterProvisioningComplete  |  ElastiCache:CacheClusterProvisioningComplete cluster-name-0001-005  |  The provisioning of a cluster is completed, and the cache nodes in the cache cluster are ready to use.  | 
|  ElastiCache:CacheClusterProvisioningFailed due to incompatible network state  |  ElastiCache:CacheClusterProvisioningFailed : cluster-name  |  An attempt was made to launch a new cluster into a nonexistent virtual private cloud (VPC).  | 
| ElastiCache:CacheClusterScalingComplete  | `CacheClusterScalingComplete : cluster-name` | Scaling for cache-cluster completed successfully. | 
| ElastiCache:CacheClusterScalingFailed | ElastiCache:CacheClusterScalingFailed : *cluster-name* | Scale-up operation on cache-cluster failed.  | 
|  ElastiCache:CacheClusterSecurityGroupModified  |  ElastiCache:CacheClusterSecurityGroupModified : cluster-name  |  One of the following events has occurred: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/AmazonElastiCache/latest/dg/ElastiCacheSNS.html)  | 
|  ElastiCache:CacheNodeReplaceStarted  |  ElastiCache:CacheNodeReplaceStarted : cluster-name  |  ElastiCache has detected that the host running a cache node is degraded or unreachable and has started replacing the cache node.  The DNS entry for the replaced cache node is not changed.  In most instances, you do not need to refresh the server-list for your clients when this event occurs. However, some cache client libraries may stop using the cache node even after ElastiCache has replaced the cache node; in this case, the application should refresh the server-list when this event occurs.  | 
|  ElastiCache:CacheNodeReplaceComplete  |  ElastiCache:CacheNodeReplaceComplete : cluster-name  |  ElastiCache has detected that the host running a cache node is degraded or unreachable and has completed replacing the cache node.  The DNS entry for the replaced cache node is not changed.  In most instances, you do not need to refresh the server-list for your clients when this event occurs. However, some cache client libraries may stop using the cache node even after ElastiCache has replaced the cache node; in this case, the application should refresh the server-list when this event occurs.  | 
|  ElastiCache:CacheNodesRebooted  |  ElastiCache:CacheNodesRebooted : cluster-name  |  One or more cache nodes has been rebooted. Message (Memcached): `"Cache node %s shutdown"` Then a second message: `"Cache node %s restarted"`  | 
|  ElastiCache:CertificateRenewalComplete (Valkey or Redis OSS only)  |  ElastiCache:CertificateRenewalComplete  |  The Amazon CA certificate was successfully renewed.  | 
|  ElastiCache:CreateReplicationGroupComplete  |  ElastiCache:CreateReplicationGroupComplete : cluster-name  |  The replication group was successfully created.  | 
|  ElastiCache:DeleteCacheClusterComplete  |  ElastiCache:DeleteCacheClusterComplete : cluster-name  |  The deletion of a cluster and all associated cache nodes has completed.  | 
| ElastiCache:FailoverComplete (Valkey or Redis OSS only) | `ElastiCache:FailoverComplete : mycluster` | Failover over to a replica node was successful.  | 
|  ElastiCache:ReplicationGroupIncreaseReplicaCountFinished  |  ElastiCache:ReplicationGroupIncreaseReplicaCountFinished : cluster-name-0001-005  |  The number of replicas in the cluster has been increased.   | 
|  ElastiCache:ReplicationGroupIncreaseReplicaCountStarted  |  ElastiCache:ReplicationGroupIncreaseReplicaCountStarted : cluster-name-0003-004  |  The process of adding replicas to your cluster has begun.   | 
|  ElastiCache:NodeReplacementCanceled  |  ElastiCache:NodeReplacementCanceled : cluster-name  |  A node in your cluster that was scheduled for replacement is no longer scheduled for replacement.   | 
|  ElastiCache:NodeReplacementRescheduled  |  ElastiCache:NodeReplacementRescheduled : cluster-name  |  A node in your cluster previously scheduled for replacement has been rescheduled for replacement during the new window described in the notification.  For information on what actions you can take, see [Replacing nodes (Valkey and Redis OSS)](CacheNodes.NodeReplacement.md).  | 
|  ElastiCache:NodeReplacementScheduled  |  ElastiCache:NodeReplacementScheduled : cluster-name  |  A node in your cluster is scheduled for replacement during the window described in the notification.  For information on what actions you can take, see [Replacing nodes (Valkey and Redis OSS)](CacheNodes.NodeReplacement.md).  | 
|  ElastiCache:RemoveCacheNodeComplete  |  ElastiCache:RemoveCacheNodeComplete : cluster-name  |  A cache node has been removed from the cluster.  | 
| ElastiCache:ReplicationGroupScalingComplete | `ElastiCache:ReplicationGroupScalingComplete : cluster-name` | Scale-up operation on replication group completed successfully.  | 
| ElastiCache:ReplicationGroupScalingFailed | `"Failed applying modification to cache node type to %s."` | Scale-up operation on replication group failed.  | 
| ElastiCache:ServiceUpdateAvailableForNode | `"Service update is available for cache node %s."` | A self-service update is available for the node.  | 
|  ElastiCache:SnapshotComplete (Valkey or Redis OSS only)  |  ElastiCache:SnapshotComplete : cluster-name  |  A cache snapshot has completed successfully.  | 
|  ElastiCache:SnapshotFailed (Valkey or Redis OSS only)  |  SnapshotFailed : cluster-name  |  A cache snapshot has failed. See the cluster’s cache events for more a detailed cause. If you describe the snapshot, see [https://docs.aws.amazon.com/AmazonElastiCache/latest/APIReference/API_DescribeSnapshots.html](https://docs.aws.amazon.com/AmazonElastiCache/latest/APIReference/API_DescribeSnapshots.html), the status will be `failed`.  | 

## Related topics

+ [Viewing ElastiCache events](ECEvents.Viewing.md)

# Log delivery


**Note**  
Slow Log is supported for Valkey 7.x and above, and Redis OSS clusters and replication groups using engine version 6.0 onward.   
Engine Log is supported for Valkey 7.x and above, and Redis OSS clusters and replication groups using engine version 6.2 onward.  
Command Log is supported for Valkey 8.1 and above.

Log delivery lets you stream [SLOWLOG](https://valkey.io/commands/slowlog), [COMMANDLOG](https://valkey.io/commands/commandlog/) (Valkey 8.1\$1), or **Engine Log** to one of two destinations:
+ Amazon Data Firehose
+ Amazon CloudWatch Logs

You enable and configure log delivery when you create or modify a cluster using ElastiCache APIs. Each log entry will be delivered to the specified destination in one of two formats: *JSON* or *TEXT*.

A fixed number of Slow log entries are retrieved from the engine periodically. Depending on the value specified for engine parameter `slowlog-max-len`, additional slow log entries might not be delivered to the destination.

You can choose to change the delivery configurations or disable log delivery at any time using the AWS console or one of the modify APIs, either [modify-cache-cluster](https://docs.aws.amazon.com/cli/latest/reference/elasticache/modify-cache-cluster.html) or [modify-replication-group](https://docs.aws.amazon.com/cli/latest/reference/elasticache/modify-replication-group.html). 

You must set the `apply-immediately` parameter for all log delivery modifications.

**Note**  
Amazon CloudWatch Logs charges apply when log delivery is enabled, even when logs are delivered directly to Amazon Data Firehose. For more information, see Vended Logs section in [Amazon CloudWatch Pricing](https://aws.amazon.com/cloudwatch/pricing/).

## Contents of a slow log entry


The Slow Log contains the following information: 
+ **CacheClusterId** – The ID of the cluster
+ **CacheNodeId** – The ID of the cache node
+ **Id** – A unique progressive identifier for every slow log entry
+ **Timestamp** – The Unix timestamp at which the logged command was processed
+ **Duration** – The amount of time needed for its execution, in microseconds
+ **Command** – The command used by the client. For example, `set foo bar` where `foo` is the key and `bar` is the value. ElastiCache replaces the actual key name and value with `(2 more arguments)` to avoid exposing sensitive data.
+ **ClientAddress** – Client IP address and port
+ **ClientName** – Client name if set via the `CLIENT SETNAME` command 

## Contents of an engine log entry


The ElastiCache Engine Log contains the following information: 
+ **CacheClusterId** – The ID of the cluster
+ **CacheNodeId** – The ID of the cache node
+ **Log level** – LogLevel can one of the following: `VERBOSE("-")`, `NOTICE("*")`, `WARNING("#")`.
+ **Time** – The UTC time of the logged message. Time is in following format: `"DD MMM YYYY hh:mm:ss.ms UTC"`
+ **Role** – Role of the node from where the log is emitted. It can be one of the following: “M” for Primary, “S” for replica, "C" for writer child process working on RDB/AOF or "X" for sentinel.
+ **Message** – Engine log message.

## Permissions to configure logging


You need to include the following IAM permissions in your IAM user/role policy: 
+ `logs:CreateLogDelivery`
+ `logs:UpdateLogDelivery`
+ `logs:DeleteLogDelivery`
+ `logs:GetLogDelivery`
+ `logs:ListLogDeliveries`

For more information, see [Overview of access management: Permissions and policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/introduction_access-management.html).

## Log type and log format specifications


### Slow log


Slow log supports both JSON and TEXT

The following shows a JSON format example:

```
{
  "CacheClusterId": "logslowxxxxmsxj", 
  "CacheNodeId": "0001", 
  "Id": 296, 
  "Timestamp": 1605631822, 
  "Duration (us)": 0, 
  "Command": "GET ... (1 more arguments)", 
  "ClientAddress": "192.168.12.104:55452", 
  "ClientName": "logslowxxxxmsxj##" 
}
```

The following shows a TEXT format example:

```
logslowxxxxmsxj,0001,1605631822,30,GET ... (1 more arguments),192.168.12.104:55452,logslowxxxxmsxj## 
```

### Engine log


Engine log supports both JSON and TEXT

The following shows a JSON format example:

```
{ 
  "CacheClusterId": "xxxxxxxxxzy-engine-log-test", 
  "CacheNodeId": "0001", 
  "LogLevel": "VERBOSE", 
  "Role": "M", 
  "Time": "12 Nov 2020 01:28:57.994 UTC", 
  "Message": "Replica is waiting for next BGSAVE before synchronizing with the primary. Check back later" 
}
```

The following shows a TEXT format example:

```
xxxxxxxxxxxzy-engine-log-test/0001:M 29 Oct 2020 20:12:20.499 UTC * A slow-running Lua script detected that is still in execution after 1000 microseconds.
```

# ElastiCache logging destinations


This section describes the logging destinations that you can choose for your ElastiCache logs. Each section provides guidance for configuring logging for the destination type and information about any behavior that's specific to the destination type. After you've configured your logging destination, you can provide its specifications to the ElastiCache logging configuration to start logging to it.

**Topics**
+ [

## Amazon CloudWatch Logs
](#Destination_Specs_CloudWatch_Logs)
+ [

## Amazon Data Firehose
](#Destination_Specs_Kinesis_Firehose_Stream)

## Amazon CloudWatch Logs

+ You specify a CloudWatch Logs log group where the logs will be delivered. 
+ Logs from multiple Valkey or Redis OSS clusters and replication groups can be delivered to the same log group. 
+ A new log stream will be created for each node within a cluster or replication group and the logs will be delivered to the respective log streams. The log stream name will use the following format: `elasticache/${engine-name}/${cache-cluster-id}/${cache-node-id}/${log-type}`

**Permissions to publish logs to CloudWatch Logs** 

You must have the following permissions settings to configure ElastiCache to send logs to a CloudWatch Logs log group:

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Action": [
                "logs:CreateLogDelivery",
                "logs:GetLogDelivery",
                "logs:UpdateLogDelivery",
                "logs:DeleteLogDelivery",
                "logs:ListLogDeliveries"
            ],
            "Resource": [
                "*"
            ],
            "Effect": "Allow",
            "Sid": "ElastiCacheLogging"
        },
        {
            "Sid": "ElastiCacheLoggingCWL",
            "Action": [
                "logs:PutResourcePolicy",
                "logs:DescribeResourcePolicies",
                "logs:DescribeLogGroups"
            ],
            "Resource": [
                "*"
            ],
            "Effect": "Allow"
        }
    ]
}
```

------

For more information, see [Logs sent to CloudWatch Logs](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AWS-logs-and-resource-policy.html#AWS-logs-infrastructure-CWL).

## Amazon Data Firehose

+ You specify a Firehose delivery stream where the logs will be delivered. 
+ Logs from multiple Valkey or Redis OSS clusters and replication groups can be delivered to the same delivery stream. 
+ Logs from each node within a cluster or replication group will be delivered to the same delivery stream. You can distinguish log messages from different cache nodes based on the `cache-cluster-id` and `cache-node-id` included in each log message. 
+ Log delivery to Firehose is currently not available in the Asia Pacific (Osaka) Region. 

**Permissions to publish logs to Firehose** 

You must have the following permissions to configure ElastiCache to send logs to an Amazon Kinesis Data Firehose delivery stream.

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Action": [
                "logs:CreateLogDelivery",
                "logs:GetLogDelivery",
                "logs:UpdateLogDelivery",
                "logs:DeleteLogDelivery",
                "logs:ListLogDeliveries"
            ],
            "Resource": [
                "*"
            ],
            "Effect": "Allow",
            "Sid": "ElastiCacheLogging"
        },
        {
            "Sid": "ElastiCacheLoggingFHSLR",
            "Action": [
                "iam:CreateServiceLinkedRole"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Sid": "ElastiCacheLoggingFH",
            "Action": [
                "firehose:TagDeliveryStream"
            ],
            "Resource": "arn:aws:iam::*:role/*",
            "Effect": "Allow"
        }
    ]
}
```

------

# Specifying log delivery using the Console


Using the AWS Management Console you can create a Valkey or Redis OSS (cluster mode disabled) cluster by following the steps at [Creating a Valkey (cluster mode disabled) cluster (Console)](SubnetGroups.designing-cluster-pre.valkey.md#Clusters.Create.CON.valkey-gs) or create a Valkey or Redis OSS (cluster mode enabled) cluster using the steps at [Creating a Valkey or Redis OSS (cluster mode enabled) cluster (Console)](Clusters.Create.md#Clusters.Create.CON.RedisCluster). In either case, you configure log delivery by doing the following;

1. Under **Advanced settings**, choose **Logs** and then check either **Slow logs** or **Engine logs**.

1. Under **Log format**, choose either **Text** or **JSON**.

1. Under **Destination Type**, choose either **CloudWatch Logs** or **Kinesis Firehose**.

1. Under **Log destination**, choose either **Create new** and enter either your Amazon S3 bucket name, CloudWatchLogs log group name or your Kinesis Data Firehose stream name, or choose **Select existing** and then choose either your CloudWatch Logs group name or your Kinesis Data Firehose stream name,

**When modifying a cluster:**

You can choose to either enable/disable log delivery or change either the destination type, format or destination:

1. Sign in to the Console and open the ElastiCache console at [https://console.aws.amazon.com/elasticache/](https://console.aws.amazon.com/elasticache/home).

1. From the navigation pane, choose **Valkey clusters** or **Redis OSS clusters**.

1. From the list of clusters, choose the cluster you want to modify. Choose the **Cluster name** and not the checkbox beside it.

1. On the **Cluster name** page, choose the **Logs** tab.

1. To enable/disable slow logs, choose either **Enable slow logs** or **Disable slow logs**.

1. To enable/disable engine logs, choose either **Enable engine logs** or **Disable engine logs**.

1. To change your configuration, choose either **Modify slow logs** or **Modify engine logs**:
   + Under **Destination Type**, choose either **CloudWatch Logs** or **Kinesis Firehose**.
   + Under **Log destination**, choose either **Create new** and enter either your CloudWatchLogs log group name or your Kinesis Data Firehose stream name. Or choose **Select existing** and then choose either your CloudWatchLogs log group name or your Kinesis Data Firehose stream name.

# Specifying log delivery using the AWS CLI


**Slow Log**

Create a replication group with slow log delivery to CloudWatch Logs.

For Linux, macOS, or Unix:

```
aws elasticache create-replication-group \
    --replication-group-id test-slow-log \
    --replication-group-description test-slow-log \
    --engine redis \
    --cache-node-type cache.r5.large \
    --num-cache-clusters 2 \
    --log-delivery-configurations '{
        "LogType":"slow-log", 
        "DestinationType":"cloudwatch-logs",  
        "DestinationDetails":{ 
          "CloudWatchLogsDetails":{ 
            "LogGroup":"my-log-group"
          } 
        }, 
        "LogFormat":"json" 
      }'
```

For Windows:

```
aws elasticache create-replication-group ^
    --replication-group-id test-slow-log ^
    --replication-group-description test-slow-log ^
    --engine redis ^
    --cache-node-type cache.r5.large ^
    --num-cache-clusters 2 ^
    --log-delivery-configurations '{
        "LogType":"slow-log", 
        "DestinationType":"cloudwatch-logs", 
        "DestinationDetails":{ 
          "CloudWatchLogsDetails":{ 
            "LogGroup":"my-log-group"
          } 
        }, 
        "LogFormat":"json" 
      }'
```

Modify a replication group to deliver slow log to CloudWatch Logs

For Linux, macOS, or Unix:

```
aws elasticache modify-replication-group \
    --replication-group-id test-slow-log \
    --apply-immediately \
    --log-delivery-configurations '
    {
      "LogType":"slow-log", 
      "DestinationType":"cloudwatch-logs", 
      "DestinationDetails":{ 
        "CloudWatchLogsDetails":{ 

          "LogGroup":"my-log-group"
        } 
      },
      "LogFormat":"json" 
    }'
```

For Windows:

```
aws elasticache modify-replication-group ^
    --replication-group-id test-slow-log ^
    --apply-immediately ^
    --log-delivery-configurations '
    {
      "LogType":"slow-log", 
      "DestinationType":"cloudwatch-logs", 
      "DestinationDetails":{ 
        "CloudWatchLogsDetails":{ 
          "LogGroup":"my-log-group"
        } 
      },
      "LogFormat":"json" 
    }'
```

Modify a replication group to disable slow log delivery

For Linux, macOS, or Unix:

```
aws elasticache modify-replication-group \
    --replication-group-id test-slow-log \
    --apply-immediately \
    --log-delivery-configurations ' 
    {
      "LogType":"slow-log", 
      "Enabled":false 
    }'
```

For Windows:

```
aws elasticache modify-replication-group ^
    --replication-group-id test-slow-log ^
    --apply-immediately ^
    --log-delivery-configurations '  
    {
      "LogType":"slow-log", 
      "Enabled":false 
    }'
```

**Engine Log**

Create a replication group with engine log delivery to CloudWatch Logs.

For Linux, macOS, or Unix:

```
aws elasticache create-replication-group \
    --replication-group-id test-slow-log \
    --replication-group-description test-slow-log \
    --engine redis \
    --cache-node-type cache.r5.large \
    --num-cache-clusters 2 \
    --log-delivery-configurations '{
        "LogType":"engine-log", 
        "DestinationType":"cloudwatch-logs",  
        "DestinationDetails":{ 
          "CloudWatchLogsDetails":{ 
            "LogGroup":"my-log-group"
          } 
        }, 
        "LogFormat":"json" 
      }'
```

For Windows:

```
aws elasticache create-replication-group ^
    --replication-group-id test-slow-log ^
    --replication-group-description test-slow-log ^
    --engine redis ^
    --cache-node-type cache.r5.large ^
    --num-cache-clusters 2 ^
    --log-delivery-configurations '{
        "LogType":"engine-log", 
        "DestinationType":"cloudwatch-logs", 
        "DestinationDetails":{ 
          "CloudWatchLogsDetails":{ 
            "LogGroup":"my-log-group"
          } 
        }, 
        "LogFormat":"json" 
      }'
```

Modify a replication group to deliver engine log to Firehose

For Linux, macOS, or Unix:

```
aws elasticache modify-replication-group \
    --replication-group-id test-slow-log \
    --apply-immediately \
    --log-delivery-configurations '
    {
      "LogType":"engine-log", 
      "DestinationType":"kinesis-firehose",
      "DestinationDetails":{
      "KinesisFirehoseDetails":{
         "DeliveryStream":"test"
       }    
     },
      "LogFormat":"json" 
    }'
```

For Windows:

```
aws elasticache modify-replication-group ^
    --replication-group-id test-slow-log ^
    --apply-immediately ^
    --log-delivery-configurations '
    {
      "LogType":"engine-log",       
      "DestinationType":"kinesis-firehose",
      "DestinationDetails":{
      "KinesisFirehoseDetails":{
         "DeliveryStream":"test"
       }  
      },
      "LogFormat":"json" 
    }'
```

Modify a replication group to switch to engine format

For Linux, macOS, or Unix:

```
aws elasticache modify-replication-group \
    --replication-group-id test-slow-log \
    --apply-immediately \
    --log-delivery-configurations ' 
    {
       "LogType":"engine-log",
       "LogFormat":"json"
    }'
```

For Windows:

```
aws elasticache modify-replication-group ^
    --replication-group-id test-slow-log ^
    --apply-immediately ^
    --log-delivery-configurations ' 
    {
       "LogType":"engine-log",
       "LogFormat":"json"
    }'
```

Modify a replication group to disable engine log delivery

For Linux, macOS, or Unix:

```
aws elasticache modify-replication-group \
    --replication-group-id test-slow-log \
    --apply-immediately \
    --log-delivery-configurations ' 
    {
      "LogType":"engine-log", 
      "Enabled":false 
    }'
```

For Windows:

```
aws elasticache modify-replication-group ^
    --replication-group-id test-slow-log ^
    --apply-immediately ^
    --log-delivery-configurations '  
    {
      "LogType":"engine-log", 
      "Enabled":false 
    }'
```

# Monitoring use with CloudWatch Metrics
Monitoring use

ElastiCache provides metrics that enable you to monitor your clusters. You can access these metrics through CloudWatch. For more information on CloudWatch, see the [CloudWatch documentation.](https://aws.amazon.com/documentation/cloudwatch/)

ElastiCache provides both host-level metrics (for example, CPU usage) and metrics that are specific to the cache engine software (for example, cache gets and cache misses). These metrics are measured and published for each Cache node in 60-second intervals.

**Important**  
You should consider setting CloudWatch alarms on certain key metrics, so that you will be notified if your cluster's performance starts to degrade. For more information, see [Which Metrics Should I Monitor?](CacheMetrics.WhichShouldIMonitor.md) in this guide.

**Topics**
+ [

# Host-Level Metrics
](CacheMetrics.HostLevel.md)
+ [

# Metrics for Valkey and Redis OSS
](CacheMetrics.Redis.md)
+ [

# Metrics for Memcached
](CacheMetrics.Memcached.md)
+ [

# Which Metrics Should I Monitor?
](CacheMetrics.WhichShouldIMonitor.md)
+ [

# Choosing Metric Statistics and Periods
](CacheMetrics.ChoosingStatisticsAndPeriods.md)
+ [

# Monitoring CloudWatch Cluster and Node Metrics
](CloudWatchMetrics.md)

# Host-Level Metrics


The `AWS/ElastiCache` namespace includes the following host-level metrics for individual cache nodes. These metrics are measured and published for each Cache node in 60-second intervals.

**See Also**
+ [Metrics for Valkey and Redis OSS](CacheMetrics.Redis.md)


| Metric | Description | Unit | 
| --- | --- | --- | 
| CPUUtilization |  The percentage of CPU utilization for the entire host. Because Valkey and Redis OSS are single-threaded, we recommend you monitor EngineCPUUtilization metric for nodes with 4 or more vCPUs. |  Percent  | 
| CPUCreditBalance | The number of earned CPU credits that an instance has accrued since it was launched or started. For T2 Standard, the CPUCreditBalance also includes the number of launch credits that have been accrued. Credits are accrued in the credit balance after they are earned, and removed from the credit balance when they are spent. The credit balance has a maximum limit, determined by the instance size. After the limit is reached, any new credits that are earned are discarded. For T2 Standard, launch credits do not count towards the limit. The credits in the CPUCreditBalance are available for the instance to spend to burst beyond its baseline CPU utilization. CPU credit metrics are available at a five-minute frequency only. This metrics is not available for T2 burstable performance instances.  | Credits (vCPU-minutes)  | 
| CPUCreditUsage | The number of CPU credits spent by the instance for CPU utilization. One CPU credit equals one vCPU running at 100% utilization for one minute or an equivalent combination of vCPUs, utilization, and time (for example, one vCPU running at 50% utilization for two minutes or two vCPUs running at 25% utilization for two minutes). CPU credit metrics are available at a five-minute frequency only. If you specify a period greater than five minutes, use the Sum statistic instead of the Average statistic. This metrics is not available for T2 burstable performance instances.  | Credits (vCPU-minutes)  | 
| FreeableMemory  |  The amount of free memory available on the host. This is derived from the RAM, buffers, and cache that the OS reports as freeable. |  Bytes  | 
| NetworkBytesIn |  The number of bytes the host has read from the network.  |  Bytes  | 
| NetworkBytesOut | The number of bytes sent out on all network interfaces by the instance.  |  Bytes  | 
| NetworkPacketsIn | The number of packets received on all network interfaces by the instance. This metric identifies the volume of incoming traffic in terms of the number of packets on a single instance.  | Count  | 
| NetworkPacketsOut |  The number of packets sent out on all network interfaces by the instance. This metric identifies the volume of outgoing traffic in terms of the number of packets on a single instance. | Count  | 
| NetworkBandwidthInAllowanceExceeded | The number of packets queued or dropped because the inbound aggregate bandwidth exceeded the maximum for the instance. | Count  | 
| NetworkConntrackAllowanceExceeded | The number of packets dropped because connection tracking exceeded the maximum for the instance and new connections could not be established. This can result in packet loss for traffic to or from the instance. | Count  | 
| NetworkBandwidthOutAllowanceExceeded | The number of packets queued or dropped because the outbound aggregate bandwidth exceeded the maximum for the instance. | Count  | 
| NetworkPacketsPerSecondAllowanceExceeded | The number of packets queued or dropped because the bidirectional packets per second exceeded the maximum for the instance. | Count  | 
| NetworkMaxBytesIn | The maximum per second burst of received bytes within each minute. | Bytes | 
| NetworkMaxBytesOut  | The maximum per second burst of transmitted bytes within each minute. | Bytes | 
| NetworkMaxPacketsIn | The maximum per second burst received packets within each minute. | Count  | 
| NetworkMaxPacketsOut | The maximum per second burst of transmitted packets within each minute. | Count  | 
| SwapUsage |  The amount of swap used on the host.  |  Bytes  | 

# Metrics for Valkey and Redis OSS


The `Amazon ElastiCache` namespace includes the following Valkey and Redis OSS metrics. These metrics are the same when using the Valkey engine.

With the exception of `ReplicationLag`, `EngineCPUUtilization`, `SuccessfulWriteRequestLatency`, and `SuccessfulReadRequestLatency`, these metrics are derived from the **info** command. Each metric is calculated at the cache node level.

For complete documentation of the **info** command, see [http://valkey.io/commands/info](https://valkey.io/commands/info). 

**See Also**
+ [Host-Level Metrics](CacheMetrics.HostLevel.md)

[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/AmazonElastiCache/latest/dg/CacheMetrics.Redis.html)

The following are aggregations of certain kinds of commands, derived from **info commandstats**. The commandstats section provides statistics based on the command type, including the number of calls, the total CPU time consumed by these commands, and the average CPU consumed per command execution. For each command type, the following line is added: `cmdstat_XXX: calls=XXX,usec=XXX,usec_per_call=XXX`.

The latency metrics listed following are calculated using commandstats statistic from [INFO](https://valkey.io/commands/info). They are calculated in the following way: `delta(usec)/delta(calls)`. `delta` is calculated as the diff within one minute. Latency is defined as CPU time taken by ElastiCache to process the command. Note that for clusters using data tiering, the time taken to fetch items from SSD is not included in these measurements.

For a full list of available commands, see [commands](https://valkey.io/commands) in the Valkey documentation. 


| Metric  | Description  | Unit  | 
| --- | --- | --- | 
| ClusterBasedCmds | The total number of commands that are cluster-based. This is derived from the commandstats statistic by summing all of the commands that act upon a cluster (cluster slot, cluster info, and so on).  | Count | 
| ClusterBasedCmdsLatency | Latency of cluster-based commands. | Microseconds | 
| EvalBasedCmds | The total number of commands for eval-based commands. This is derived from the commandstats statistic by summing eval, evalsha. | Count | 
| EvalBasedCmdsLatency | Latency of eval-based commands. | Microseconds | 
| GeoSpatialBasedCmds | The total number of commands for geospatial-based commands. This is derived from the commandstats statistic. It's derived by summing all of the geo type of commands: geoadd, geodist, geohash, geopos, georadius, and georadiusbymember. | Count | 
| GeoSpatialBasedCmdsLatency | Latency of geospatial-based commands.  | Microseconds | 
| GetTypeCmds | The total number of read-only type commands. This is derived from the commandstats statistic by summing all of the read-only type commands (get, hget, scard, lrange, and so on.) | Count | 
|  GetTypeCmdsLatency |  Latency of read commands.  | Microseconds | 
| HashBasedCmds | The total number of commands that are hash-based. This is derived from the commandstats statistic by summing all of the commands that act upon one or more hashes (hget, hkeys, hvals, hdel, and so on). | Count | 
|  HashBasedCmdsLatency |  Latency of hash-based commands.  | Microseconds | 
| HyperLogLogBasedCmds | The total number of HyperLogLog-based commands. This is derived from the commandstats statistic by summing all of the pf type of commands (pfadd, pfcount, pfmerge, and so on.). | Count | 
|  HyperLogLogBasedCmdsLatency |  Latency of HyperLogLog-based commands.  | Microseconds | 
| JsonBasedCmds | The total number of JSON commands, including both read and write commands. This is derived from the commandstats statistic by summing all JSON commands that act upon JSON keys. | Count | 
| JsonBasedCmdsLatency | Latency of all JSON commands, including both read and write commands. | Microseconds | 
| JsonBasedGetCmds | The total number of JSON read-only commands. This is derived from the commandstats statistic by summing all JSON read commands that act upon JSON keys. | Count | 
| JsonBasedGetCmdsLatency | Latency of JSON read-only commands. | Microseconds | 
| JsonBasedSetCmds | The total number of JSON write commands. This is derived from the commandstats statistic by summing all JSON write commands that act upon JSON keys. | Count | 
| JsonBasedSetCmdsLatency | Latency of JSON write commands. | Microseconds | 
| KeyBasedCmds | The total number of commands that are key-based. This is derived from the commandstats statistic by summing all of the commands that act upon one or more keys across multiple data structures (del, expire, rename, and so on.). | Count | 
|  KeyBasedCmdsLatency |  Latency of key-based commands.  | Microseconds | 
| ListBasedCmds | The total number of commands that are list-based. This is derived from the commandstats statistic by summing all of the commands that act upon one or more lists (lindex, lrange, lpush, ltrim, and so on). | Count | 
|  ListBasedCmdsLatency |  Latency of list-based commands.  | Microseconds | 
| NonKeyTypeCmds | The total number of commands that are not key-based. This is derived from the commandstats statistic by summing all of the commands that do not act upon a key, for example, acl, dbsize or info. | Count | 
| NonKeyTypeCmdsLatency | Latency of non-key-based commands. | Microseconds | 
| PubSubBasedCmds | The total number of commands for pub/sub functionality. This is derived from the commandstatsstatistics by summing all of the commands used for pub/sub functionality: psubscribe, publish, pubsub, punsubscribe, ssubscribe, sunsubscribe, spublish, subscribe, and unsubscribe. | Count | 
| PubSubBasedCmdsLatency | Latency of pub/sub-based commands. | Microseconds | 
| SetBasedCmds | The total number of commands that are set-based. This is derived from the commandstats statistic by summing all of the commands that act upon one or more sets (scard, sdiff, sadd, sunion, and so on). | Count | 
|  SetBasedCmdsLatency |  Latency of set-based commands.  | Microseconds | 
| SetTypeCmds | The total number of write types of commands. This is derived from the commandstats statistic by summing all of the mutative types of commands that operate on data (set, hset, sadd, lpop, and so on.) | Count | 
|  SetTypeCmdsLatency |  Latency of write commands.  | Microseconds | 
| SortedSetBasedCmds | The total number of commands that are sorted set-based. This is derived from the commandstats statistic by summing all of the commands that act upon one or more sorted sets (zcount, zrange, zrank, zadd, and so on). | Count | 
|  SortedSetBasedCmdsLatency |  Latency of sorted-based commands.  | Microseconds | 
| StringBasedCmds | The total number of commands that are string-based. This is derived from the commandstats statistic by summing all of the commands that act upon one or more strings (strlen, setex, setrange, and so on). | Count | 
|  StringBasedCmdsLatency |  Latency of string-based commands.  | Microseconds | 
| StreamBasedCmds | The total number of commands that are stream-based. This is derived from the commandstats statistic by summing all of the commands that act upon one or more streams data types (xrange, xlen, xadd, xdel, and so on). | Count | 
|  StreamBasedCmdsLatency |  Latency of stream-based commands.  | Microseconds | 
| SearchBasedCmds | The total number of Search commands, including both read and write commands. This is derived from the commandstats statistic by summing all Search commands. | Count | 
| SearchBasedCmdsLatency | Latency of all Search commands, including both read and write commands. | Microseconds | 
| SearchBasedGetCmds | The total number of Search read-only commands. This is derived from the commandstats statistic by summing all Search read commands. | Count | 
| SearchBasedGetCmdsLatency | Latency of Search read-only commands. | Microseconds | 
| SearchBasedSetCmds | The total number of Search write commands. This is derived from the commandstats statistic by summing all Search write commands. | Count | 
| SearchBasedSetCmdsLatency | Latency of Search write commands. | Microseconds | 

# Metrics for Memcached


The `AWS/ElastiCache` namespace includes the following Memcached metrics.

The AWS/ElastiCache namespace includes the following metrics that are derived from the Memcached stats command. Each metric is calculated at the cache node level.

**See also**
+ [Host-Level Metrics](CacheMetrics.HostLevel.md)


| Metric  | Description  | Unit  | 
| --- | --- | --- | 
| BytesReadIntoMemcached | The number of bytes that have been read from the network by the cache node. | Bytes | 
| BytesUsedForCacheItems | The number of bytes used to store cache items. | Bytes | 
| BytesWrittenOutFromMemcached | The number of bytes that have been written to the network by the cache node. | Bytes | 
| CasBadval | The number of CAS (check and set) requests the cache has received where the Cas value did not match the Cas value stored.  | Count | 
| CasHits | The number of Cas requests the cache has received where the requested key was found and the Cas value matched. | Count | 
| CasMisses | The number of Cas requests the cache has received where the key requested was not found.   | Count | 
| CmdFlush | The number of flush commands the cache has received. | Count | 
| CmdGet | The number of get commands the cache has received. | Count | 
| CmdSet | The number of set commands the cache has received. | Count | 
| CurrConnections | A count of the number of connections connected to the cache at an instant in time. ElastiCache uses 2 to 3 of the connections to monitor the cluster. In addition to the above, memcached creates a number of internal connections equal to twice the threads used for the node type. The thread count for the various node types can be see in the `Nodetype Specific Parameters` of the applicable Parameter Group. The total connections is the sum of client connections, the connections for monitoring and the internal connections mentioned above.  | Count | 
| CurrItems | A count of the number of items currently stored in the cache. | Count | 
| DecrHits | The number of decrement requests the cache has received where the requested key was found. | Count | 
| DecrMisses | The number of decrement requests the cache has received where the requested key was not found. | Count | 
| DeleteHits | The number of delete requests the cache has received where the requested key was found. | Count | 
| DeleteMisses | The number of delete requests the cache has received where the requested key was not found. | Count | 
| Evictions | The number of non-expired items the cache evicted to allow space for new writes. | Count | 
| GetHits | The number of get requests the cache has received where the key requested was found. | Count | 
| GetMisses | The number of get requests the cache has received where the key requested was not found. | Count | 
| IncrHits | The number of increment requests the cache has received where the key requested was found. | Count | 
| IncrMisses | The number of increment requests the cache has received where the key requested was not found. | Count | 
| Reclaimed | The number of expired items the cache evicted to allow space for new writes. | Count | 

For Memcached 1.4.14, the following additional metrics are provided.


| Metric  | Description  | Unit  | 
| --- | --- | --- | 
| BytesUsedForHash | The number of bytes currently used by hash tables. | Bytes | 
| CmdConfigGet | The cumulative number of config get requests. | Count | 
| CmdConfigSet | The cumulative number of config set requests. | Count | 
| CmdTouch | The cumulative number of touch requests. | Count | 
| CurrConfig | The current number of configurations stored. | Count | 
| EvictedUnfetched | The number of valid items evicted from the least recently used cache (LRU) which were never touched after being set. | Count | 
| ExpiredUnfetched | The number of expired items reclaimed from the LRU which were never touched after being set. | Count | 
| SlabsMoved | The total number of slab pages that have been moved. | Count | 
| TouchHits | The number of keys that have been touched and were given a new expiration time. | Count | 
| TouchMisses | The number of items that have been touched, but were not found. | Count | 

The AWS/ElastiCache namespace includes the following calculated cache-level metrics.


| Metric  | Description  | Unit  | 
| --- | --- | --- | 
| NewConnections | The number of new connections the cache has received. This is derived from the memcached total\$1connections statistic by recording the change in total\$1connections across a period of time. This will always be at least 1, due to a connection reserved for a ElastiCache. | Count | 
| NewItems | The number of new items the cache has stored. This is derived from the memcached total\$1items statistic by recording the change in total\$1items across a period of time. | Count | 
| UnusedMemory | The amount of memory not used by data. This is derived from the Memcached statistics limit\$1maxbytes and bytes by subtracting bytes from limit\$1maxbytes. Because Memcached overhead uses memory in addition to that used by data, UnusedMemory should not be considered to be the amount of memory available for additional data. You may experience evictions even though you still have some unused memory. For more detailed information, see [Memcached item memory usage](https://web.archive.org/web/20190422040715/https://www.deplication.net/2016/02/memcached-item-memory-usage/).  | Bytes | 

# Which Metrics Should I Monitor?


The following CloudWatch metrics offer good insight into ElastiCache performance. In most cases, we recommend that you set CloudWatch alarms for these metrics so that you can take corrective action before performance issues occur.

**Topics**
+ [

## CPUUtilization
](#metrics-cpu-utilization)
+ [

## EngineCPUUtilization
](#metrics-engine-cpu-utilization)
+ [

## SwapUsage (Valkey and Redis OSS)
](#metrics-swap-usage)
+ [

## Evictions
](#metrics-evictions)
+ [

## CurrConnections
](#metrics-curr-connections)
+ [

## Memory (Valkey and Redis OSS)
](#metrics-memory)
+ [

## Network
](#metrics-network)
+ [

## Latency
](#metrics-latency)
+ [

## Replication
](#metrics-replication)
+ [

## Traffic Management (Valkey and Redis OSS)
](#traffic-management)

## CPUUtilization


This is a host-level metric reported as a percentage. For more information, see [Host-Level Metrics](CacheMetrics.HostLevel.md).

**Valkey and Redis OSS**

 For smaller node types with 2vCPUs or less, use the `CPUUtilization ` metric to monitor your workload.

Generally speaking, we suggest you set your threshold at 90% of your available CPU. Because Valkey and Redis OSS are both single-threaded, the actual threshold value should be calculated as a fraction of the node's total capacity. For example, suppose you are using a node type that has two cores. In this case, the threshold for CPUUtilization would be 90/2, or 45%. 

You will need to determine your own threshold, based on the number of cores in the cache node that you are using. If you exceed this threshold, and your main workload is from read requests, scale your cluster out by adding read replicas. If the main workload is from write requests, depending on your cluster configuration, we recommend that you:
+ **Valkey or Redis OSS (cluster mode disabled) clusters:** scale up by using a larger cache instance type.
+ **Valkey or Redis OSS (cluster mode enabled) clusters:** add more shards to distribute the write workload across more primary nodes.

**Tip**  
Instead of using the Host-Level metric `CPUUtilization`, Valkey and Redis OSS users might be able to use the metric `EngineCPUUtilization`, which reports the percentage of usage on the Valkey or Redis OSS engine core. To see if this metric is available on your nodes and for more information, see [Metrics for Valkey and Redis OSS](CacheMetrics.Redis.md).

For larger node types with 4vCPUs or more, you may want to use the `EngineCPUUtilization` metric, which reports the percentage of usage on the Valkey or Redis OSS engine core. To see if this metric is available on your nodes and for more information, see [Metrics for Redis OSS](CacheMetrics.Redis.md).

**Memcached**

Because Memcached is multi-threaded, this metric can be as high as 90%. If you exceed this threshold, scale your cluster up by using a larger cache node type or scale out by adding more cache nodes.

## EngineCPUUtilization


For larger node types with 4vCPUs or more, you may want to use the `EngineCPUUtilization` metric, which reports the percentage of usage on the Redis OSS engine core. To see if this metric is available on your nodes and for more information, see [Metrics for Valkey and Redis OSS](CacheMetrics.Redis.md).

For more information, see the **CPUs** section at [Monitoring best practices with Amazon ElastiCache for Redis OSS using Amazon CloudWatch](https://aws.amazon.com/blogs/database/monitoring-best-practices-with-amazon-elasticache-for-redis-using-amazon-cloudwatch/).

## SwapUsage (Valkey and Redis OSS)


This is a host-level metric reported in bytes. For more information, see [Host-Level Metrics](CacheMetrics.HostLevel.md).

The `FreeableMemory` CloudWatch metric being close to 0 (i.e., below 100MB) or `SwapUsage` metric greater than the `FreeableMemory` metric indicates a node is under memory pressure. If this happens, see the following topics:
+ [Ensuring you have enough memory to make a Valkey or Redis OSS snapshot](BestPractices.BGSAVE.md)
+ [Managing reserved memory for Valkey and Redis OSS](redis-memory-management.md)

## Evictions


This is a cache engine metric. We recommend that you determine your own alarm threshold for this metric based on your application needs.

If you are using Memcached and exceed your chosen threshold, scale your cluster up by using a larger node type or scale out by adding more nodes.

## CurrConnections


This is a cache engine metric. We recommend that you determine your own alarm threshold for this metric based on your application needs.

An increasing number of *CurrConnections* might indicate a problem with your application; you will need to investigate the application behavior to address this issue. 

For more information, see the **Connections** section at [Monitoring best practices with Amazon ElastiCache for Redis OSS using Amazon CloudWatch](https://aws.amazon.com/blogs/database/monitoring-best-practices-with-amazon-elasticache-for-redis-using-amazon-cloudwatch/).

## Memory (Valkey and Redis OSS)


Memory is a core aspect of Valkey and Redis OSS. Understanding the memory utilization of your cluster is necessary to avoid data loss and accommodate future growth of your dataset. Statistics about the memory utilization of a node are available in the memory section of the [INFO](https://valkey.io/commands/info) command.

For more information, see the **Memory** section at [Monitoring best practices with Amazon ElastiCache for Redis OSS using Amazon CloudWatch](https://aws.amazon.com/blogs/database/monitoring-best-practices-with-amazon-elasticache-for-redis-using-amazon-cloudwatch/).

## Network


One of the determining factors for the network bandwidth capacity of your cluster is the node type you have selected. For more information about the network capacity of your node, see [Amazon ElastiCache pricing](https://aws.amazon.com/elasticache/pricing/).

For more information, see the **Network** section at [Monitoring best practices with Amazon ElastiCache for Redis OSS using Amazon CloudWatch](https://aws.amazon.com/blogs/database/monitoring-best-practices-with-amazon-elasticache-for-redis-using-amazon-cloudwatch/).

## Latency


Measuring response time for an ElastiCache for Valkey instance can be approached in various ways depending on the level of granularity required. The key stages that contribute to the overall server-side response time for ElastiCache for Valkey are command pre-processing, command execution, and command post-processing. 

 Command-specific latency metrics derived from the Valkey [INFO](https://valkey.io/commands/info) command such as GetTypeCmdsLatency and SetTypeCmdsLatency metric focus specifically on executing the core command logic for the Valkey command. These metrics will be helpful if your use case is to determine the command execution time or aggregated latencies per data structure.

The latency metrics `SuccessfulWriteRequestLatency` and `SuccessfulReadRequestLatency` measure the total time that the ElastiCache for Valkey engine takes to respond to a request.

**Note**  
Inflated values for `SuccessfulWriteRequestLatency` and `SuccessfulReadRequestLatency` metrics can occur when using Valkey pipelining with CLIENT REPLY enabled on the Valkey client. Valkey pipelining is a technique for improving performance by issuing multiple commands at once, without waiting for the response to each individual command. To avoid inflated values, we recommend configuring your Valkey client to pipeline commands with [CLIENT REPLY OFF](https://valkey.io/commands/client-reply/).

For more information, see the **Latency** section at [Monitoring best practices with Amazon ElastiCache using Amazon CloudWatch](https://aws.amazon.com/blogs/database/monitoring-best-practices-with-amazon-elasticache-for-redis-using-amazon-cloudwatch/).

## Replication


The volume of data being replicated is visible via the `ReplicationBytes` metric. Although this metric is representative of the write load on the replication group, it doesn't provide insights into replication health. For this purpose, you can use the `ReplicationLag` metric. 

For more information, see the **Replication** section at [Monitoring best practices with Amazon ElastiCache for Redis OSS using Amazon CloudWatch](https://aws.amazon.com/blogs/database/monitoring-best-practices-with-amazon-elasticache-for-redis-using-amazon-cloudwatch/).

## Traffic Management (Valkey and Redis OSS)


 ElastiCache for Redis OSS automatically manages traffic against a node when more incoming commands are sent to the node than can be processed by Valkey or Redis OSS. This is done to maintain optimal operation and stability of the engine. 

 When traffic is actively managed on a node, the metric `TrafficManagementActive` will emit data points of 1. This indicates that the node may be underscaled for the workload being provided. If this metric remains 1 for long periods of time, evaluate the cluster to decide if scaling up or scaling out is necessary. 

 For more information, see the `TrafficManagementActive` metric on the [Metrics](CacheMetrics.Redis.md) page.

# Choosing Metric Statistics and Periods


While CloudWatch will allow you to choose any statistic and period for each metric, not all combinations will be useful. For example, the Average, Minimum, and Maximum statistics for CPUUtilization are useful, but the Sum statistic is not.

All ElastiCache samples are published for a 60 second duration for each individual cache node. For any 60 second period, a cache node metric will only contain a single sample.

For further information on how to retrieve metrics for your cache nodes, see [Monitoring CloudWatch Cluster and Node Metrics](CloudWatchMetrics.md).

# Monitoring CloudWatch Cluster and Node Metrics


ElastiCache and CloudWatch are integrated so you can gather a variety of metrics. You can monitor these metrics using CloudWatch. 

**Note**  
The following examples require the CloudWatch command line tools. For more information about CloudWatch and to download the developer tools, see the [ CloudWatch product page](https://aws.amazon.com/cloudwatch). 

The following procedures show you how to use CloudWatch to gather storage space statistics for an cluster for the past hour. 

**Note**  
The `StartTime` and `EndTime` values supplied in the examples below are for illustrative purposes. You must substitute appropriate start and end time values for your cache nodes.

For information on ElastiCache limits, see [AWS Service Limits](https://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html#limits_elasticache) for ElastiCache.

## Monitoring CloudWatch Cluster and Node Metrics (Console)


 **To gather CPU utilization statistics for a cache cluster** 

1. Sign in to the AWS Management Console and open the ElastiCache console at [ https://console.aws.amazon.com/elasticache/](https://console.aws.amazon.com/elasticache/).

1. Select the cache nodes you want to view metrics for. 
**Note**  
Selecting more than 20 nodes disables viewing metrics on the console.

   1. On the **Cache Clusters** page of the AWS Management Console, click the name of one or more clusters.

      The detail page for the cluster appears. 

   1. Click the **Nodes** tab at the top of the window.

   1. On the **Nodes** tab of the detail window, select the cache nodes that you want to view metrics for.

      A list of available CloudWatch Metrics appears at the bottom of the console window. 

   1. Click on the **CPU Utilization** metric. 

      The CloudWatch console will open, displaying your selected metrics. You can use the **Statistic** and **Period** drop-down list boxes and **Time Range** tab to change the metrics being displayed. 

## Monitoring CloudWatch Cluster and Node Metrics using the CloudWatch CLI


 **To gather CPU utilization statistics for a cache cluster** 
+ For Linux, macOS, or Unix:

  ```
  aws cloudwatch get-metric-statistics \
      --namespace AWS/ElastiCache \
      --metric-name CPUUtilization \
      --dimensions='[{"Name":"CacheClusterId","Value":"test"},{"Name":"CacheNodeId","Value":"0001"}]' \					
      --statistics=Average \
      --start-time 2018-07-05T00:00:00 \
      --end-time 2018-07-06T00:00:00 \
      --period=3600
  ```

  For Windows:

  ```
  aws cloudwatch get-metric-statistics ^
      --namespace AWS/ElastiCache ^
      --metric-name CPUUtilization ^
      --dimensions='[{"Name":"CacheClusterId","Value":"test"},{"Name":"CacheNodeId","Value":"0001"}]' ^
      --statistics=Average ^
      --start-time 2018-07-05T00:00:00 ^
      --end-time 2018-07-06T00:00:00 ^
      --period=3600
  ```

## Monitoring CloudWatch Cluster and Node Metrics using the CloudWatch API


 **To gather CPU utilization statistics for a cache cluster** 
+ Call the CloudWatch API `GetMetricStatistics` with the following parameters (note that the start and end times are shown as examples only; you will need to substitute your own appropriate start and end times):
  + `Statistics.member.1``=Average`
  + `Namespace``=AWS/ElastiCache`
  + `StartTime``=2013-07-05T00:00:00`
  + `EndTime``=2013-07-06T00:00:00`
  + `Period``=60`
  + `MeasureName``=CPUUtilization`
  + `Dimensions``=CacheClusterId=mycachecluster,CacheNodeId=0002`  
**Example**  

  ```
   1. http://monitoring.amazonaws.com/
   2.     ?Action=GetMetricStatistics
   3.     &SignatureVersion=4
   4.     &Version=2014-12-01
   5.     &StartTime=2018-07-05T00:00:00
   6.     &EndTime=2018-07-06T23:59:00
   7.     &Period=3600
   8.     &Statistics.member.1=Average
   9.     &Dimensions.member.1="CacheClusterId=mycachecluster"
  10.     &Dimensions.member.2="CacheNodeId=0002"
  11.     &Namespace=&AWS;/ElastiCache
  12.     &MeasureName=CPUUtilization						
  13.     &Timestamp=2018-07-07T17%3A48%3A21.746Z
  14.     &AWS;AccessKeyId=<&AWS; Access Key ID>
  15.     &Signature=<Signature>
  ```