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
- Open the aws cloudwatch console at console
- Choose or click on Create alarms
Step 2: Select EC2 Metrics
- Click on Create alarm -> Select metric
- Search EC2 -> Select Usage > By AWS Resources
- Choose Service EC2 and Resource RunInstances
- Click on Select metric
Step 3: Specify metric and conditions
- Pick Statistics Sum (Statistics are metric data aggregations over specified periods of time)
- 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.)
- 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).
- Click on Next
Step 4: Create a topic and add an email id
- Create new topic > Name the topic “ec2_running_instances”
- Add Email address
- Click on Create topic
- Check your mail and Subscribe to the topic
- Click on Next
Step 5: Add alarm name and description
- Add alrams name
- Add Description of alarm
- Click on Next
Step 6: Preview
- Preview the alarm and settings
- Click on Create alarm
1 thought on “How to set alarms and notifications in AWS CloudWatch3 min read”
Comments are closed.