I need to be notified within five minutes if any critical EC2 infrastructure goes down, as it can take up to 30 minutes for us to notice. I initially set up a CloudWatch alarm on CPUUtilization, expecting it to trigger an alert if it averages 0% for five minutes. However, when I tested it by shutting down an instance, I didn't receive any notifications from SNS. What are some better methods or recommendations to achieve this alerting?
6 Answers
I’ve seen some folks use CloudTrail for notifications, but be careful with that since it tracks API calls and can have latency issues. For instance shutdowns, you might miss the event because of the delay.
You might want to take a look at using EventBridge combined with SNS for email notifications whenever certain events occur with your EC2 instances. You can define what triggers the alerts based on the instance state, making it pretty straightforward to set up.
For monitoring instance stoppage specifically, consider setting up an EventBridge rule that reacts to state-change events, which can then send an SNS message to alert you via email when it happens. Another approach could be to add a status check to the instance to cover your bases.
We’ve been using Better Stack and previously used Pingdom. These services can provide low-cost monitoring as long as you have a public endpoint for them to connect to, which can be really helpful in keeping track of your instance status!
Look into EC2 auto-scaling lifecycle hooks. They might be useful for setting up alerts when your instances enter a down state. It can definitely help keep you informed!
Have you considered configuring your CloudWatch alarm to trigger if it doesn't receive any data? If there's no CPU utilization data, it could notify you that the instance might be down, potentially solving your problem.
Related Questions
Can't Load PhpMyadmin On After Server Update
Redirect www to non-www in Apache Conf
How To Check If Your SSL Cert Is SHA 1
Windows TrackPad Gestures