You have monitoring enabled on your EC2 instance. Now you would like to get notified when certain conditions arise.
Use CloudWatch Alarms to set up notification.
All of the recipes in this book are focused on the EC2 and S3 services. However, for this particular recipe we will dip our toe into one other Amazon Web Service, the Simple Notification Service. This service provides a very simple yet robust publish and subscribe service, which does a great job as a scalable method of implementing communication between processes or services. We won’t be able to cover the details of SNS in detail, but this example will show you how to leverage SNS to quickly enable email notification of CloudWatch events using alarms.
The following commands assume that you have signed up for SNS with
your AWS account. The first step in enabling CloudWatch alarms is to
create an SNS topic to which events can be published. People or systems
that are interested in these events can then subscribe to the topic.
When you subscribe, you can select a number of different notification
protocols. For example, you could select
http, which would
JSON payload containing the message contents to be
HTTP to the endpoint you provide.
Or you can subscribe via SQS (Simple Queue Service), which will place a
message in an SQS queue. For this example, we will use the