How to set alarms and notifications in AWS CloudWatch

Reading Time: 3 minutes

Introduction

AWS CloudWatch is just another AWS service that monitors your other AWS resources and services. You can use to collect metrics and logs in real-time and you can track the metrics. Also, you can create custom dashboards for your applications that are using AWS resources.

In this blog, we will learn to set alarms and push notifications for our resource metrics. Alarms can be used to inform you whenever a resource exceeds its threshold so you can take required actions.

So our agenda is to set an alarm using cloudwatch whenever running EC2 instances exceed a particular number.

Prerequisites

  • An AWS account
  • Running EC2 Instance

Steps for creating an alarm on running EC2 instances using AWS CloudWatch

Step 1: CloudWatch console

  1. Open the aws cloudwatch console at console
  2. Choose or click on Create alarms
aws cloudwatch console

Step 2: Select EC2 Metrics

  1. Click on Create alarm -> Select metric
  2. Search EC2 -> Select Usage > By AWS Resources
  3. Choose Service EC2 and Resource RunInstances
  4. Click on Select metric
add metrics for alarm

Step 3: Specify metric and conditions

  1. Pick Statistics Sum (Statistics are metric data aggregations over specified periods of time)
  2. Choose period 1 hour (Period is the length of time to evaluate the metric or expression to create each individual data point for an alarm.)
  3. Define Conditions
    • Threshold type – Static
    • condition whenever – Greater/Equal
    • Threshold value – 1 (means if running instances equals or greater than n , the alarm will send a notification).
  4. Click on Next
Conditions

Step 4: Create a topic and add an email id

  1. Create new topic > Name the topic “ec2_running_instances”
  2. Add Email address
  3. Click on Create topic
  4. Check your mail and Subscribe to the topic
  5. Click on Next
mail

Step 5: Add alarm name and description

  1. Add alrams name
  2. Add Description of alarm
  3. Click on Next
name and description of alram

Step 6: Preview

  1. Preview the alarm and settings
  2. Click on Create alarm
alram console

Whenever your resources exceeds the threshold, AWS will send a notification email

Notification email

Written by 

Rahul Soni is a Software Consultant at Knoldus Software. He is always charged up for new things & learnings. He is dedicated to his work and believes in quality output. He loves to take deep dives into cloud technologies & different tools.

1 thought on “How to set alarms and notifications in AWS CloudWatch3 min read

Comments are closed.

Discover more from Knoldus Blogs

Subscribe now to keep reading and get access to the full archive.

Continue reading