Wondering how to monitor automatic recovery instances using CloudWatch alarms? We can help you!
Here at Bobcares, we often get requests from our customers to configure monitoring of Automatic recovery.
Today let’s see how our Support Engineers do this set up for our customers as a part of our Server Management Services.
How to Monitor Automatic Recovery Instances Using CloudWatch Alarms
We can configure a CloudWatch alarm to automatically recover impaired instances and notify us through Amazon SNS. However, the SNS notification alone will not have results of the automatic recovery action.
Therefore, we must configure a CloudWatch Events rule to monitor AWS Personal Health Dashboard events for our instance.
Steps for Creating a CloudWatch alarm for Amazon EC2 instances
Following are the steps that our Support Techs follow to create CloudWatch alarms:
1. Firstly, we have to open the Amazon EC2 console.
2. Then go to Instances and select the instance that we wish to configure.
3. After that go to Actions, and click on Monitor and troubleshoot.
4. Then we have to select Manage CloudWatch alarms.
5. Next, click on Create an alarm.
6. And for Alarm notification, we can provide an existing Amazon Simple Notification Service (Amazon SNS) topic.
7. After that, toggle on Alarm action, and click on Recover.
8. We must provide an appropriate statistic and metric for our use case for Group samples by and Type of data to sample.
9. Furthermore, we must specify the evaluation period for the alarm for Consecutive period and Period.
10. Also, we can Modify the automatically created Alarm name (this is optional).
11. Now, click on Create.
12. And enter the SNS topic name for Send notification to.
13. Further, we must select Recover for Take the action.
14. Then for Target, give the SNS topic we created.
Using AWS CLI to list the AWS Health events associated with EC2 instance
We can also use the AWS CLI to list the AWS Health events associated with EC2 instance automatic recovery.
The following commands can be used:
$ aws health describe-event-types --filter services=EC2 --query eventTypes.code --region us-east-1 | grep AUTO_RECOVERY "AWS_EC2_INSTANCE_AUTO_RECOVERY_FAILURE", "AWS_EC2_INSTANCE_AUTO_RECOVERY_NO_ACTION", "AWS_EC2_INSTANCE_AUTO_RECOVERY_SUCCESS",
Automatic recovery results will get emailed to both our AWS account’s main contact and alternate contact. We can look for email subject lines similar to the following ones:
[Need assistance? We can help you]
To conclude, we saw the steps that our Support Techs follow to set up CloudWatch alarms for monitoring automatic recovery instances.