Amazon CloudWatch is a service that you can use to monitor your AWS resources and your applications in real time.With Amazon Cloud Watch,you can collect and track metrics,create alarms that send notifications,and make changes to the resources being monitored based on rules you define.
You can specify parameters for a metric over a time period and configure alarms and automated actions when a threshold is reached.
Amazon CloudWatch offers either basic or detailed monitoring for supported AWS products.
Basic monitoring sends data points to Amazon CloudWatch every five minutes for a limited number of pre selected metrics at no charge.
Detailed monitoring sends data points to Amazon CloudWatch every minute and allows data aggregation for an additional charge.If you want to use detailed monitoring,you must enable it—basic is the default
AWS provides a rich set of metrics included with each service,but you can also define custom metrics to monitor resources and events.
Amazon CloudWatch Log scan be used to monitor,store,and access log files from Amazon EC2 instances.
Amazon CloudWatch Log scan also be used to store your logs in Amazon S3 or Amazon Glacier.
Each AWS account is limited to 5,000 alarms per AWS account,and metrics data is retained for two weeks by default.
Sample image for EC2 instance cloud watch monitorings.
Metrics form the core of Amazon CloudWatch’s functionality.Essentially,these are nothing more than certain values to be monitored.Each metric has some data points associated with it which tend to change as time progresses.
An alarm basically watches over a particular metric for a stipulated period of time and performs some actions based on its trigger. These actions can be anything from sending a notification to the concerned user using the Simple Notification Service(SNS).
Monitoring your account’s estimate charges using Cloud Watch.
You can configure the alerts on your AWS usage by using the Cloud watch alarms.Here is the steps to create an alarm on estimated charges.
- Log in with root account credentials
- Select My Account option and navigate to“Preferences”
- Go to Select Receive Billing Alerts checkbox and select“Manage Billing Alerts”option. (Cloudwatch alarms will create in North Virginia region).
4. When you click on“Manage Billing Alerts”option,you’ll redirect to Cloudwatch dashboard,there select create a Billing alert option.Automatically create alarm windows will open.
- In this windows,enter the USD value,when you want to receive the notifications and enter your email id which you want to get the notifications,Click on“Create Alarm”When your monthly usage reaches to 5$ you’ll get notified by the cloudwatch service through the mentioned email.
- AWS does not allow the billing alarm’s period to be set less than 6 hours.Here is how exactly billing alarm looks like.
ALARM Threshold details:
With the Alarm’s threshold set,the final thing that you need to do is define what action the alarm must take when it is triggered. From the Notification section, fill out the required details, as mentioned in the following:
Whenever this alarm:This option will allow you to determine when the alarm will actually perform an action.There are three states of an alarm out of which you can select any one at a single time:
State is ALARM: Triggered when the metric data breaches the threshold value set by you
State is OK: Triggered when the metric data is well within the supplied threshold value.
State is INSUFFICIENT: Triggered when the alarm generally doesn’t have enough data with itself to accurately determine the alarm’s state
Monitoring your instance’s CPU Utilization using Cloud Watch
We are going to creating a simple alarm to monitor an instance’s CPU utilization. If the CPU utilization breaches a certain threshold, say 75 percent, then the alarm will trigger an email notification as well as perform an additional task such as stop/restart the instance.
AWS makes creating alarms a really simple and straight forward process.The easiest way to do this is by selecting your individual instances from the EC2 Management Dashboard and selecting the Monitoring tab.Each instance is monitored on a five-minute interval by default.We can modify this behavior and set the time interval as low as one minute by selecting the Enable Detailed Monitoring option
Each instance Monitoring graphs display important metric information such as CPU utilization,disk Read/Writes,bytes transferred interms of network IO. We can expand on each of the graphs by simply selecting them.
The x axis displays the CPU utilization in percent where as the y axis display the time as per the current period’s settings.We can view the individual data points and their associated values by simply hovering over them on the graph.Alternatively,you can also switch between the Statistics, Time Range,and Period as per our requirements.
- Once you have viewed your instance’s performances,you can create a simple alarm by selecting the Create Alarm option provided in the Monitoring tab.
- Click on Create Alarm option as shown below image
3. Now you’ll get a windows with all the available options to create an alarm.
If you want to get the notifications to an email ID,we need to depend on another service called SNS,click on“Create topic on Send notifications to”Then give a name Enter a valid email to get the notifications in“With these recipients field”.
Select the Take the action,what action you want to perform on instance,when the alarm matches with the defined threshold.In this case am selecting Reboot this instance (Criteria am mentioning is when CPU utilization >80 % for consecutive of 5 minutes).
To perform this action,we have to create a role,If we have any existing role,we can attach it,otherwise select the option“Create IAM role”.
Here am defining the thresholds about the alarm,Whenever Maximum of CPU Utilization is>= 80 Percent for at least 1 consecutive period of 5 Minutes.
Then allocating a name for this Alarm
Alarm created successfully,we can verify the same from.
We have 1,377 Metrics till date.We can use any of the one
Dashboard is a centralized place to monitor all your resources. Free Tier.
New and existing customers also receive 3 dashboards of upto 50 metrics each per month at no additional charge.($3.00 per dashboard per month after that)
Basic Monitoring metrics (at five-minute frequency)for Amazon EC2 instances are free of charge,as are all metrics for Amazon EBS volumes,Elastic Load Balancers,and Amazon RDS DB instances.
New and existing customers also receive 10 metrics,10 alarms and1million API requests each month at no additional charge
More Information : https://www.fgrade.com/aws/