AWS CloudWatch Alarms and Metrics

Sumit
5 min readMar 26, 2019
Ref: https://bit.ly/2YnYWt4

AWS CloudWatch, as we know, is a powerful service provided by Amazon for monitoring and managing our AWS services. It provides us with data and actionable insights which we can use to monitor our application/websites, understand and respond to critical changes, optimise resource utilisation and get a consolidated view of the entire account.

CloudWatch collects monitoring and operational information in the form of logs, metrics, and events.

Let’s dive into the matter now and discuss the reason why I am writing this blog. This blog is going to be about configuring CloudWatch alarms and the different metrics we can use to configure them. I will also be including screen grabs from my account which will assist you in following the steps that I mention.

After you have launched an instance, you can see various monitoring aspects of it on the EC2 dashboard itself.

Monitoring tab

Select the particular instance and then click on the Monitoring tab as shown above. You will see various parameters which can be used to monitor the instance. Eg: CPU Utilisation, Disk Reads, Disk Read Operations etc. If you click on one of the metrics, say CPU Utilisation, you’ll get the below graph which gives detailed information on the metric.

CPU Utilisation

We can select Statistic, Time Range and Period and check the graph as per our requirement. Since this is basic monitoring, we can get data every 5 minutes of the period. We can also enable detailed monitoring from the same dashboard but keep in mind that there is a charge associated with it.

Option to enable Detailed Monitoring

The only difference between basic monitoring and detailed monitoring is that basic works every 5 minutes and detailed monitoring work every 1 minute. Rest of the features are the same.

I am sure you are overwhelmed after checking all the available metrics, so I would like to add that System Check Failed (Instance) and Status Check Failed (System) are super important and they are recommended to be configured in an environment. An interesting thing to note here is, these are the same System Checks which we see while we launch an instance. See below for reference.

System Checks Status

We cannot connect to an instance unless both of the status checks are passed. There is a separate tab on the same dashboard for both the checks, as you can see below:

System status checks verify the network reachability to the instance and instance status checks verify whether the instance operating system is accepting network traffic. These checks can be configured from the EC2 dashboard itself, so now shift our focus to CloudWatch alarms.

The above screenshot shows the CloudWatch dashboard and if you click on Metrics on the left panel, you will be able to see all the metrics available which can be used to configure CloudWatch alarms. There is an additional metric of billing, which is only available in North Virginia region, which can be used to set up billing alerts.

Now I will show you how to create an alarm, say, that of CPU Utilisation. Using the same method, you can create other alarms that you would require.

Step 1: Go to Alarms section and then click on Select Metric.

Step 2: One click on the Select Metric button will lead you to the metric selection page, where you can go to EC2> Per-Instance Metric and then click on the corresponding metric against the EC2 instance.

You can already notice some values on the graph for CPU Utilisation. Select this metric and then you will get options to name the alarm and set threshold.

Step 3: You can name the alarm as I have shown above and set the threshold 70%. It means, every time the CPU Utilisation reaches 70% or goes above, we will get a notification. We can also set alarm to go off if the CPU Utilisation goes below a certain number, say 10%. In that case, you can also click on the EC2 Action button and perform an action whenever the CPU Utilisation goes below 10%. For reference, check below screenshot.

EC2 Action

Conclusion

So we just saw how to configure a CloudWatch alarm and also take certain actions based on the metrics that we use. CloudWatch provides a good service considering the fact that it’s easy to start, no up-front commitment or minimum fee and you only pay for what you use.

--

--