4.12 CloudWatch EC2 - Lab
Remember that CloudWatch is not just for monitoring EC2 instance. EBS, ELB, S3, DynamoDB, RDS can also be monitored by CloudWatch.
Steps:
Go to your EC2 instance, and go to Monitoring tab. By default, it is basic monitoring which give you different metrics every 5 minutes. We can enable detailed monitoring which drops it down to 1 minute, but you will be charged for that.
Go to your console and go to CloudWatch. You can go to Dashboard and then "Create dashboard" for the services you are using, for example EC2, and then you can "Add widgets" to this dashboard to monitoring different metrics.
You need to know what metrics are available by default for your EC2 instance. They are (If you want to have Memory/RAM monitoring, you need to create custom metric and that is out of the scope of this course):
CPU load related
Disk IO related
Network IO related
Status check, which is checking both of the virtual machine (instance level) and the hypervisor (host level) are up or not.
Go to CloudWatch and then go to Alarm, and then you can "Create Alarm" for different metrics through setting the threshold.
Go to CloudWatch and then go to Event, and then you can "Create rule" to respond events. When resources change states, they automatically send events to an event stream and then you create rules that match the selected events and route them to targets to take action.
Go to CloudWatch and then go to Logs, and then you can "Create log group" so that you can monitor your EC2 instance at application level such as monitoring HTTP response code, you can also monitor the kernel through kernel logs. What you need to do is to install an agent on your EC2 instance, this agent will then pass back monitoring data to CloudWatch Logs and then you'll be able to view the CloudWatch logs inside this log portal. Using Logs can help you to monitoring in application layer, not just host layer (CPU, Disk, etc).
Exam Tips:
Standard Monitoring = 5 mins, retention period of datapoints = 63 days.
Detailed Monitoring = 1 min, retention period of datapoints = 15 days.
Dashboards - create awesome dashboards to see what is happening with your AWS environment.
Alarm - allows you to set Alarms that notify you when particular thresholds are hit.
Events - CloudWatch Events helps you to respond to state changes in your AWS resources.
Logs - CloudWatch Logs helps you to aggregate, monitor, and store logs.
CloudWatch vs. CloudTrail
CloudWatch: for monitoring, such as logging, performance and resources monitoring.
CloudTrail: for auditing, such as account monitoring, user and role monitoring, S3 monitoring.
Last updated
Was this helpful?