Cloudwatch alarms is a great way for system administrators to monitor the system and allows AWS to automatically send emails to via SNS when an alarm criteria changes from OK to Alarm. For example, an alarm can be setup to trigger when the CPU usage of an EC2 instance or RDS instance is over 90% or for example when the number of objects in a S3 bucket is over 200.
In this demo, an alarm is created for RDS when CPU usage is more than 90%.
To create an alarm, login to AWS console and open Cloudwatch and click on Alarms from the left menu and then click on Create Alarm. Metrics are categorised by services. Click on RDS metrics. A number of metrics are displayed. Select "CPU Utilization". A graph is displayed below as shown below and then click Next.
On the next screen, set the threshold for the CPU usage and set the name and description for the alarm. Note that there is a field for consecutive periods and the period (time) can be set from the Period section under Alarm Preview.
From the above example, when the period is set to 5 minutes and applies for 1 consecutive period, the notification emails will be sent if CPU usage goes over 90%. If the period is set to 5 minutes and applies for 3 consecutive periods, the state will change to alarm when CPU usage is higher than 90% for 3 consecutive periods.
A preview for the alarm is shown on the screen. From the Actions section, select or create a notification list where the emails will be sent.