Amazon CloudWatch is a service used for monitoring servers which run on Amazon Web Services (AWS). It enables users to have a real-time monitoring of AWS resources such as Amazon EC2 instances, Amazon EBS (Elastic Block Store), ElastiCache and Amazon RDS database instances. AWS provides metrics for CPU utilization, latency, and request counts; allowing users to custom the metrics to be monitored, such as the memory usage, transaction volumes or error rates. This application allows users to view their application behaviour with the statistics in a graph format.
AWS management console provides access to Amazon Cloudwatch. Within the console, we use the EC2 matrix. A matrix is created for each instance. An instance will have a unique instance id and an instance name and a metric name. In this article we will focus on the CPU Utilization Metric.
There are different alarms that can be created to monitor the metrics in your application. When we create an alarm we have to first decide on the Amazon CloudWatch metric which we want to monitor. Metric can be like the CPU utilization, throughput, queue length, etc. Next, we choose the evaluation period (e.g., 1min, 5 mins, 15 mins, 1hour, or 1 day) and a statistical value to measure (e.g., Average, Min, Max, or Sum). To set a threshold, set a target value and choose whether the alarm will trigger when the value is greater than (>), greater than or equal to (>=), less than (<), or less than or equal to (<=) that value.
Following is the Graph for CPU Utilization. The evaluation period is 5 mins. The trigger is CPU Utilization > 50 all through the evaluation period. This will remain in the alarm state until it no longer breaches the set threshold.