

# Amazon SNS monitoring of ElastiCache events
<a name="ECEvents"></a>

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
<a name="ECEvents.SNS"></a>

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
<a name="ECEvents.SNS.Adding"></a>

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)
<a name="ECEvents.SNS.Adding.Console"></a>

 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)
<a name="ECEvents.SNS.Adding.CLI"></a>

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)
<a name="ECEvents.SNS.Adding.API"></a>

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
<a name="ECEvents.SNS.Disabling"></a>

 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)
<a name="ECEvents.SNS.Disabling.Console"></a>

**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)
<a name="ECEvents.SNS.Disabling.CLI"></a>

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)
<a name="ECEvents.SNS.Disabling.API"></a>

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
<a name="ECEvents.Viewing"></a>

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)
<a name="ECEvents.Viewing.CON"></a>

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)
<a name="ECEvents.Viewing.CLI"></a>

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)
<a name="ECEvents.Viewing.API"></a>

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
<a name="ElastiCacheSNS"></a>

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
<a name="ElastiCacheSNS.Events"></a>

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
<a name="ElastiCacheSNS.SeeAlso"></a>
+ [Viewing ElastiCache events](ECEvents.Viewing.md)