Sending an e-mail based on a CloudWatch alarm

This recipe is similar to the previous one. However, in this case, we set up metrics, alarms, and notifications that are vital to the operations team. CloudWatch alarms help you notify users by e-mail, if any of the specified metrics cross their predefined thresholds. For example, you can collect latency metrics from the ELB and trigger an alarm that sends an e-mail notification to the operations team, if the latency exceeds 60 milliseconds. CloudWatch uses Simple Notification Service (SNS) to send these e-mails. The administrators and operations teams subscribe to this SNS topic to receive the CloudWatch notifications.

How to do it…

  1. Create an SNS topic.

    In the following example, the command creates the ...

Get Amazon EC2 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.