With CloudWatch, you can receive notifications of usage metrics when they reach a specified threshold automatically, as an alarm for when any EC2 instance uses more than 80% CPU.
We have created a simple tutorial that will help you through the process of creating alarms in just 10 minutes.
Based on data from the CleanCloud Explorer, you can analyze your metrics history and identify patterns to create alarms in CloudWatch more accurately and then take action.
Navigate to the AWS console, go to CloudWatch, and click All alarms.
In the upper left corner, go to the Alarms tab, and then click the Create alarm button.
Click the Select metric button to set the metrics of the alarm that will be created.
On the Select metric screen, click EC2.
For CPU utilization metrics, select the Per instance Metrics option, search for the CPUUtilization metric, and select the resource you want to monitor. Then click Select metric.
On the creation screen, perform the settings based on our example:
Select Maximum in the Statistics field.
Choose 5 minutes under Period.
Under Conditions, set the threshold type to static, whenever the CPUUtilization is greater than 80.
In Additional settings, set the number of ratings above the threshold at which the alarm should be triggered. In our example, if 3 ratings are above 80% CPU within a total of 5 ratings, the alarm is triggered.
Click Next.
In “Notification”, perform the following settings:
For Alarm state trigger, we will use the In alarm option based on our example.
Select an existing topic or create a new one.
From the Add notification button, it is possible to add more than one notification. In that case, we add for when the alarm returns to the OK state and also for sending by SNS thread.
After these settings, click Next.
Set a name for the alarm and add an optional short description. Then click Next.
On the screen of Preview and create confirm that all the information is correct. Finally, click on Create alarm.
Finally, a success message will appear to confirm the creation of the alarm.
🎉 From now on, you will receive metric alarms as they have been established to further optimize your AWS cloud.