Cloudwatch alarms for other AWS Services

Defining A CloudWatch Alarm

Amazon CloudWatch Alarms – Watch a single metric over to see if it crosses a thresh-hold over a time period – all of which you specify (i.e metric, timeperiod(s), and thresh-hold).

When A CloudWatch Alarm Fires

CloudWatch  alarms only fire with state change – in other words – the state must have changed and been maintained for a specified number of periods to a condition you specified when you created the alarm.

The alarm will not fire if state has not changed.

Actions – once the alarm has fired

Then you specify, and perform one or more actions based on the value of the metric relative to a given threshold over a number of time periods. The action is a notification sent to an Amazon Simple Notification Service (Amazon SNS) topic or Amazon EC2 Auto Scaling policy etc.

CloudWatch Events

You can setup automated actions based on predefined events using conditional rules.
What is the difference between a CloudWatch Alarm and a CloudWatch event?  Events are pre-defined for many AWS Services – and you do not specify thresh-holds for an event – you specify rules for events using SNS Topics – that can kick of notifications to any service supported by like:

 HTTP
 Email-JSON
 Application
 HTTPS
 SMS
 AWS Lambda
 Email
 Amazon SQS

Per Amazon documentation:

  • Events—An event indicates a change in your AWS environment. AWS resources can generate events when their state changes. For example, Amazon EC2 generates an event when the state of an EC2 instance changes from pending to running, and Amazon EC2 Auto Scaling generates events when it launches or terminates instances. AWS CloudTrail publishes events when you make API calls. You can generate custom application-level events and publish them to CloudWatch Events. You can also set up scheduled events that are generated on a periodic basis. For a list of services that generate events, and sample events from each service, see CloudWatch Events Event Examples From Each Supported Service.
  • Targets—A target processes events. Targets can include Amazon EC2 instances, AWS Lambda functions, Kinesis streams, Amazon ECS tasks, Step Functions state machines, Amazon SNS topics, Amazon SQS queues, and built-in targets. A target receives events in JSON format.
  • Rules—A rule matches incoming events and routes them to targets for processing. A single rule can route to multiple targets, all of which are processed in parallel. Rules are not processed in a particular order. This enables different parts of an organization to look for and process the events that are of interest to them. A rule can customize the JSON sent to the target, by passing only certain parts or by overwriting it with a constant.

More from LonzoDB on AWS

Reference

https://aws.amazon.com/documentation/cloudwatch/
https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html
https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/WhatIsCloudWatchEvents.html

Leave a Comment

Scroll to Top