- AWS provides fully managed services to automatically provision,configure and manage the AWS and on-premises resources.
- AWS provides a broad set of services to monitor infrastructure logs and metrics using real-time dashboards and alarms.
- Amazon CloudWatch monitors the AWS resources and services.
- It collect and track metrics of the resources and applications.
- CloudWatch sends notifications to user about the changes occur in resources.
- Amazon CloudWatch monitors Amazon Web Services (AWS) resources and the applications that are running on AWS in real time.
- CloudWatch is used to collect and track metrics of resources and applications.
- CloudWatch alarms send notifications or automatically make changes to the resources that are monitoring based on defined rules.
Accessing Amazon CloudWatch
Methods to access Amazon CloudWatch are:
- Amazon CloudWatch console
- AWS CLI
- CloudWatch API
- AWS SDKs
Amazon CloudWatch related Services
AWS services related to Amazon CloudWatch are:
- Amazon SNS
- Auto Scaling
- AWS CloudTrail
- AWS Identity and Access Management
- Amazon SNS:
Amazon Simple Notification Service (Amazon SNS) coordinates and manages the delivery or sending of messages to subscribing endpoints or clients.
- Auto Scaling:
It is used to automatically launch or terminate Amazon EC2 instances based on user-defined policies, health status checks, and schedules.
- AWS CloudTrail:
It is used to monitor the calls made to the Amazon CloudWatch API for a particular account, including calls made by the AWS Management Console, AWS CLI, and other services.
- AWS Identity and Access Management (IAM):
It is a web service that helps the users to securely control access to AWS resources.
How Amazon CloudWatch Work?
Amazon CloudWatch is basically a metrics repository.
An AWS product—such as Amazon EC2—puts metrics into the repository, and user’s retrieve statistics based on those metrics.
If user put their own custom metrics into the repository, then they can retrieve statistics on these metrics as well.
- Metrics are used to calculate statistics and then present the data graphically in the CloudWatch console.
- User’s can configure alarm actions to stop, start, or terminate an Amazon EC2 instance when certain criteria are met.
The Amazon CloudWatch Concepts are
The namespace is the container for CloudWatch metrics.
Metrics in different namespaces are isolated from each other to increase fault tolerance.
There is no default namespace it means user must specify a namespace for each data point that publish to CloudWatch.
Metrics are the fundamental concept in CloudWatch.
It represents a time-ordered set of data points that are published to CloudWatch.
Metrics exist only in the region in which they are created.
Metrics cannot be deleted, but they automatically expire after 15 months if no new data is published to them.
Metrics are uniquely defined by a name, a namespace, and one or more dimensions.
Each data point has a timestamp, and a unit of measure.
Timestamp: Each metric data point must be marked with a time stamp. The time stamp can be up to two weeks in the past and up to two hours into the future.
A dimension is a name/value pair that uniquely identifies a metric.
User’s can assign up to ten dimensions to a metric.
Every metric has specific characteristics that describe it.
AWS services that send data to CloudWatch attach dimensions to each metric. It is used to filter the results that CloudWatch returns.
Statistics are metric data aggregations over specified periods of time.
Aggregations are made using the namespace, metric name, dimensions, and the data point unit of measure, within the time period that user’s specify.
Amazon CloudWatch Concept
Units: Each statistic has a unit of measure. Example of units include Bytes, Seconds, Count, and Percent.
Periods: A period is the length of time associated with a specific Amazon CloudWatch statistic.
Aggregation: Amazon CloudWatch aggregates statistics according to the period length that is specified by user’s while retrieving statistics.For large data sets, user’s can insert a pre-aggregated data set called a statistic set.
A percentile indicates the relative standing of a value in a data set.
For example, the 95th percentile means that 95 percent of the data is below this value and 5 percent of the data is above this value.
Percentiles help to get a better understanding of the distribution of your metric data.
CloudWatch needs raw data points to calculate percentiles.
To retrieve percentile statistics for particular data then one of the following conditions must be true:
- The Sample Count of the statistic set is 1
- The Min and the Max of the statistic set are equal
An alarm watches a single metric over a specified time period.
It performs one or more specified actions, based on the value of the metric relative to a threshold over time.
User’s can use an alarm to automatically initiate actions on their behalf
The action is a notification sent to an Amazon SNS or an Auto Scaling policy.
Amazon CloudWatch Set up
To use Amazon CloudWatch user’s must need an AWS account.
The AWS account allows users to use services (for example, Amazon EC2) to generate metrics that can be viewed in the CloudWatch console, a point-and-click web-based interface.
Steps to set up the Amazon CloudWatch service
- Sign up for an AWS account
- Sign in to the Amazon CloudWatch console
To sign up for an AWS account
1.Open https://aws.amazon.com/, and then choose Create an AWS Account.
2.Follow the online instructions.
Part of the sign-up procedure involves receiving a phone call and entering a PIN using the phone keypad.
To sign in to the Amazon CloudWatch console
1.Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/.
2.If necessary, use the navigation bar to change the region to the region where you have your AWS resources.
3.Even if this is the first time you are using the CloudWatch console, Your Metrics could already report metrics, because you have used a AWS product that automatically pushes metrics to Amazon CloudWatch for free.
4.If you do not have any alarms, the Your Alarms section will have a Create Alarm button.
You can use the AWS CLI or the Amazon CloudWatch CLI to perform CloudWatch commands.