Setup integration: Amazon ElastiCache Notification
You need to set up an AWS SNS HTTPS endpoint for this integration!
Amazon ElastiCache provides in-memory databases such as Redis or memcached. ElastiCache Event Notifications are published when significant events happen on a cache cluster. An event can be the start of an automated backup, a failover to a replica, or much more. You can get either all event types or none; there is no filter feature available in ElastiCache. That’s why marbot filters them. Alerts are only triggert for the following event names:
I provide an easier way to setup ElastiCache memcached monitoring. Checkout my Monitoring Jump Start!
You need an existing ElastiCache Redis cluster (Multi-AZ with Auto-Failover enabled) for this example to work!
You can run the Redis cluster in Multi-AZ with Auto-Failover mode. Multi-AZ will use at least two virtual machines to host your cluster (primary and replicas). The replicas keep the same data in-memory as the primary. If the primary goes down, AWS will failover to one of the secondaries. But this will take up to 6 minutes. You may want to know about this event because it will cause connection errors in your applications.
Before you can start to set up ElastiCache Notifications, you have to make one change to the SNS topic endpoint that is required for this integration. You have to allow ElastiCache Notifications to send messages to your topic.
- Visit https://console.aws.amazon.com/sns/?region=us-east-1
- Click on the Topics link on the left
- Select the topic that you created for marbot
- Click on the Actions button, where you click on the Edit topic policy link.
- Select the Advanced view tab
If this is the first time you edit the SNS topic policy, you should see a default entry like this:
If you see the default entry, go to the next step. Otherwise, replace it with this policy:
- Replace ARN with your SNS topic ARN that you created for marbot.
- Replace ACCOUNT_ID with your AWS Account ID.
- Click on the Update policy button to save the policy.
Now, AWS is allowed to send messages to your topic.
- Visit https://console.aws.amazon.com/elasticache/home?region=us-east-1
- Click on the Redis link on the left
- Select your Redis cluster
- Click on the Modify button
- Set *Enabling ElastiCache Notifications to
marbotor your other SNS topic name
- Enable Apply immediately
- The other fields can stay as they are
- Save by clicking the Modify button.
You can simulate a failover with the AWS CLI. Replace the following value in the command below:
- REPLICATION_GROUP_ID with the name of the Redis cluster
aws --region us-east-1 elasticache test-failover --replication-group-id REPLICATION_GROUP_ID --node-group-id 0001
You should receive an alert in Slack: