Lab 9 1: Monitoring Instances with Amazon CloudWatch - nicolas-tullio/Tech-Journal GitHub Wiki
Deliverables
Screenshot of your CloudWatch Graph for CPU Utilization of your Running Instance
Screenshot of CPU Utilization Graph taken from EC2 Console
Screenshot of Alarm with details (click on the alarm link)
Steps
- By default, Amazon EC2 sends metric data to CloudWatch in 5-minute periods
- To send metric data for your instance to CloudWatch in 1-minute periods, you can enable detailed monitoring on the instance
Enable Detailed Monitoring
Select your instance and choose Actions, Monitor and Troubleshoot, Manage detailed monitoring
- NOTE: Basic Monitoring (5 minute metrics) for EC2 in CLoudWatch is free. Detailed Monitoring for EC2 in CloudWatch can cost money if you have multiple instances and operations.
Use CloudWatch to determine the maximum CPU utilization of a specific EC2 instance
To display the CPU utilization for a specific instance, navigate to CloudWatch > Metrics
Choose the EC2 metric namespace
Choose the Per-Instance Metrics dimension
In the search field, enter CPUUtilization and press Enter
Choose the row for the specific instance, which displays a graph for the CPUUtilization metric for the instance
To change the statistic or the period for the metric, choose the Graphed metrics tab. Choose the column heading or an individual value, and then choose a different value.
CloudWatch Graphs in EC2 Console
Return to the EC2 Console
Select your Instance
Click on the Monitoring Tab
The following graphs are available:
-
Average CPU Utilization (Percent)
-
Average Disk Reads (Bytes)
-
Average Disk Writes (Bytes)
-
Maximum Network In (Bytes)
-
Maximum Network Out (Bytes)
-
Summary Disk Read Operations (Count)
-
Summary Disk Write Operations (Count)
-
Summary Status (Any)
-
Summary Status Instance (Count)
-
Summary Status System (Count)
Generating Alarms in CloudWatch
Update the SecurityGroup for your Instance to allow ICMPv4 Inbound from Any
Set up a continual ping from your workstation to your EC2 instance
Create an alarm using the Amazon EC2 console
Select your instance and choose Actions, Monitor and Troubleshoot, Manage CloudWatch alarms
For Alarm notification, you can toggle off to configure Amazon Simple Notification Service (Amazon SNS) notifications for now
For Alarm action, Review the options so you can see what actions could be available - but for this lab we will toggle off.
NetworkPacketsIn
metric
For Alarm thresholds, use the -
Group Samples by Average
-
Criteria is greater than or equal 10 packets (for some reason, in testing it was showing "Bytes" above the packet count filed - but when the alarm was created, it was correct. It was likely a JavaScript issue
-
For Consecutive period, enter 1. For Period, select 5 minutes.
Choose Create
Let your ping run for a few minutes - now check:
- Instance NetworkPacketsIn metric graph in CloudWatch
- You should see an Alarm show up in CloudWatch
- You should also see an Alarm for the instance show up in the EC2 Console
Turn off Detailed Monitoring
Once you have collected all your screenshots - go to EC2 Console - Instances - Select Instance - Actions - Manage and Troubleshoot - Manage Detailed Monitoring - uncheck Enable
- That will prevent any CloudWatch Billing.