How to setup a Cloud Watch
Last Updated :
20 Dec, 2023
Amazon CloudWatch, a key component of Amazon Web Services (AWS), is a service for real-time monitoring. Designed to empower users with vital data and actionable insights. It facilitates the continuous monitoring of applications, and performance adjustments across systems. It collects operational data in the form of logs, metrics, and events. It also offers users a perspective on AWS resources, applications, and services operating within the AWS environment.
Components Of Cloud Watch
- EC2 (Elastic Compute Cloud): Before starting with CloudWatch we must know what is EC2, it is the Amazon Web Service we use to create and run virtual machines in the cloud (we call these virtual machines ‘instances’).To set CloudWatch we must have one EC2 instance running on your machine. If you don’t know how to launch an EC2 instance you can refer to this article.
- Resource Groups: AWS Resource Groups lets us organize all the resources such as EC2 instances, RDS database, and S3 buckets into groups using tags that we define while launching/creating instances services. It is a collection of resources that match the resource types specified in a query, and share one or more tags or portions of tags.
- Cloudwatch Logs: CloudWatch Logs allows us to see all of our logs, regardless of their source, as a single and consistent flow of events ordered by time with the help of Graphs.
- Cloudwatch Alarms: CloudWatch Alarms allow us to set different types of alarms which notify us if any Matric goes above the threshold (will be set while creating an alarm).
Steps To Configure Cloud Watch
Step 1: Go to https://aws.amazon.com/ and Sign in.
Step 2: In the Search Bar, search for EC2 as shown below.
EC2
Step 3: After clicking on EC2 from search bar you will land on EC2 dashboard where all the stuff about EC2 is displayed. Click on Instances.
EC2 Dashboard
Step 4: Here you will get all the EC2 which are running, stopped, terminated, etc. Select the one you want to use. Make sure its Running.
Select Running EC2 Instance
Step 5: Goto to tags section where you will found Key-Value pair, note this down somewhere.
Goto Tags
Step 6: Again goto search bar, search for Resource Groups.
Resource Groups
Step 7: After landing in Resource Groups page, from left side select Create Resource Group. In group type select EC2:Instace.
Search EC2 Instance
Step 8: Scroll down you will find Tags section here, select you Key-Value of ypur EC2 in this tags and select them. You can also select multiple tags if you want.
Select Tag
Step 9: Scroll down more, name your resource group and hit Create Group.
Group Name
Step 10: If you get message something like shown in image below then you successfully created Resource Group.
Create Group
Step 11: Now goto search bar and search for Cloudwatch.
Cloudwatch
Step 12: Select filter from ‘Filter by resource group’ and select your Resource Group which we made earlier.
Filter by Group
Step 13: Scroll down and click on ‘View EC2 dashboard‘ and you will get all the necessary graphs.
Graphs
Follow next steps if you want to set alarms.
Step 14: On the left menu got Alarms > All alarms > Create alarm > Select metric. Now select EC2 as were setting alarm for EC2 instance.
Step 15: Select Pre-Instance Metric and now select where Metric Name is CPUUtilization.
Metric Name
Step 16: Scroll down and set threshold according to your needs. Click Next
Threshold
Step 17: In Notification, Create a New Topic. Enter Topic name and your Email address. Create and Next.
Create Topic
Step 18: Set preferred Alarm name, Next > Create Alarm.
Alarm Created
Step 19: If you get notification for Pending Cornfirmation, confirm subscription from your mail.
Step 20: After confirming subscription confirm from SNS subscription page.
Conclusion
We have seen how to setup Cloudwatch using EC2 instance and Resource Groups. We have also seen how to set alarm for your EC2 instance to get notification on your mails for CPU Utilization.
Frequently Asked Questions (FAQs) On Cloud Watch
1. Can We Add More than 1 tags in Resource Groups?
Yes, just add all the tags you want from Tags section.
2. Can we set our own Metric?
Yes. we can set our own metric.
3. Is It Possible To Specify More Than One Action For A Single CloudWatch Alarm?
Yes, this enables you to execute various automated responses in reaction to the alert threshold being crossed.
4. What is quota for Cloudwatch Sanbox Account?
- Metrics: 200 custom metrics per region per account.
- Dashboards: 20 dashboards per account.
- Logs: 1,000 log groups per region per account.
- Log Insights queries: 1,000 saved queries per region per account.
- Alarms: 200 alarms per region per account.
5. What are the costs beyond the free tier (Sandbox) ?
- Additional metrics: $0.01 per metric per month.
- Additional dashboards: $0.50 per dashboard per month.
- Additional log data: $0.03 per GB per month.
- Additional Log Insights queries: $0.01 per minute.
- Additional alarms: $0.10 per alarm per month.
Share your thoughts in the comments
Please Login to comment...