Monitor AWS Resources Using Cloudwatch Alarms

What Is Cloudwatch?

Cloudwatch is a monitoring and logging service in aws which helps us to monitor our aws resources in the form of logs and metrics.

We can use cloudwatch to collect metrics of the applications and services we are running in real time.

It also helps us to store the server and application logs.

If you want to send application logs to cloudwatch , Please refer this article.

Sending Server and Application logs to Cloudwatch

By default , Amazon Cloudwatch services collects metrics from each aws resources If required you can enable detailed monitoring as well.

In this article , We will see how we can monitor and alert for aws resources based on the metrics and threshold we configure in cloudwatch alarm.

What Is Cloudwatch Alarm?

Cloudwatch alarm is used to monitor single cloudwatch metric or the result of Match expression using cloudwatch metrics.

Also it send out a notification based on the threshold we set for each services in the cloudwatch alarm.

You can actively monitor the status of each alarms in the cloudwatch dashboard.

States Of Cloudwatch Alarms:

There are 3 states in the cloudwatch alarms:

  • OK – The metric is below the threshold.
  • ALARM – When the metric crosses the threshold.
  • INSUFFICIENT_DATA – Not enough data available for the metric to determine the alarm state.


We need an SNS Topic with a Subscriber for the Cloudwatch alarm to alert us based on the alarm configuration.

I have published a very detailed article on How to create SNS Topic with Subscriber.

Once you have setup SNS topic and the subscriber , Lets go ahead and create a Cloudwatch alarm.

Creating Cloudwatch Alarm:

We have to choose the metric of the aws resources for the cloudwatch alarm to monitor and the threshold configured for that metric.

To create Cloudwatch alarm , Open the Cloudwatch Console,

In the left navigation pane , Choose Alarms

Click Create Alarm ,


Here we need to select the AWS resource , For example , EC2 and the Metric , For example , CPU Utilization.

Click Select metric ,

Under Metrics , Select EC2 , For this tutorials , We monitor EC2 Metrics using Cloudwatch alarm.

And then click , Per-Instance Metrics

In the Next Page , Choose the EC2 Instance and the Metric name You want to Monitor.

And click Select Metric ,

In the Next page , You can find the details such as Metric name, name space , InstanceId and Instance name which you have chosen in the previous page.

Statistics are the data collected over the specific period of time.And these data made using the Metric name, name space , dimensions , datapoint unit of measure.

We choose Minimum statistics for the period of 1 minute.

Under Conditions ,

Threashold type can be Static or Dynamic.

Lets setup Static threshold , When the CPU utilization is greater than or equal to 70 percent.

Click Next ,


We already have a SNS topic ad the subscriber in place , To create , Refer here.

When the cloudwatch alarm turns to ALARM state , We will use SNS topic to alert us.

Whenever this alarm state is , In Alarm

Select an SNS topic Which you have created.

If you want to get the alert when the metric value goes below threshold.

Click Add new notification , Select OK and the SNS topic which we have created.

Click Next , Provide a name for the Alarm , Click Next.

Choose Create alarm.

Now that we have created an alarm to monitor the CPU Utilization of the EC2 Instance based on the metrics and alert based on the threshold using SNS topic.

Thanks for reading this article.

Please do check out my other publications.