Creating a CloudWatch alarm

To create a CloudWatch alarm, we can simply navigate to the CloudWatch management console and select alarms from the menu:

  1. We click the blue Create Alarm button to open the Create new alarm dialog:

  1. In the Create new alarm dialogue, we need to first select a metric by clicking on the Select metric button:

  1. This will open another dialogue where we can select the metrics. We have the ability to select metrics from different categories and drill down to the exact metric that we would like to set a threshold on. In this example, we selected EC2 and the Per-Instance Metrics where we selected the CPUUtilization metric to use in our alarm. We also have the ability to rename the metric by clicking on the little pencil icon in the upper-left corner of the dialogue.

Once we are satisfied with our selection, we click on the Select metric button:

  1. Going back to the Create new alarm dialogue, we will now see the metric and a preview of the graph. We will need to scroll further down to configure the alarm:

  1. Scrolling further down, we need to name the alarm and optionally give it a description. In the Alarm details, we also need to configure the threshold and the duration of the threshold breach before the alarm is triggered. As we can see in the example, we have selected that the alarm will be triggered when the CPU utilization is above 80% for two out of five sequential data points:

  1. Further down, we will create an action. In the example, the action is just a notification that will be sent out to a notification SNS topic that has previously been created within our account. We are also able to add additional actions including autoscaling actions that can increase or decrease the number of instances in our autoscaling group and EC2 actions that can perform a recover, stop, terminate, or reboot action on our EC2 instance:

  1. Once the alarm is created, the service will display the alarm in the management console:

In this example, we configured an alarm that will notify us of an abnormal EC2 instance condition via an email that is sent out via the SNS service. This is a very useful alarm that can be implemented not only on single instances but on fleets of instances running in our EC2 environment.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.12.166.255