Amazon AWS CloudWatch is a service designed to monitor and control the resources and applications you run on AWS. CloudWatch provides real-time monitoring of your various resources, such as your EC2 or RDS instances, your load balancers, etc.
You can use CloudWatch to collect and track various metrics, monitor your diagnostic logs and create alarms so that you can react effectively to any changes in your AWS resources.
💡Related articles:
How do you monitor performance?
Amazon CloudWatch gives users complete visibility of their resource utilisation, application performance and the overall health of their AWS infrastructure.
In order to understand how this works, it is important to understand these fundamental concepts:
- Namespaces: these are logical containers for metrics. They can be thought of as categories or groups of metrics associated with a particular application, service or resource. They must be unique, and will be created before any metrics can be collected.
- Metrics: this is performance data sent to CloudWatch. They can include information about the performance of various AWS resources (EC2 instances, DynamoDB databases, Lambda functions, etc.). They are identified by a name, a unit of measurement, a dimension and a namespace.
- Dimensions: dimensions are additional metric attributes that can be used to filter and segment their data. They are key-value pairs that can be used to create custom views based on different attributes of your AWS environment.
- Statistics: these are calculated values for a given metric over a specified period of time. CloudWatch automatically calculates statistics for all metrics and makes them available for analysis and monitoring.
- Percentiles (percentages): these measure the distribution of values for a metric, in the form of a percentage. They can be used to understand performance trends and abnormal behaviour of AWS resources.
- Alarms: these are threshold rules above which an automated action is triggered when a metric exceeds or falls below a specified threshold. This is an essential tool for monitoring the performance of your AWS resources in real time.
Think of CloudWatch as a metrics warehouse. Your AWS service will record its metrics in this warehouse, and you’ll get statistics based on these metrics.
Amazon CloudWatch Logs: logging
CloudWatch Logs lets you access, monitor and store log files from their AWS resource. Thanks to these logs you will be able to diagnose your systems and applications.
Here are some of the features of CloudWatch Logs:
Log Collection |
Log collection can be performed from various sources, such as EC2 instances, Docker containers, AWS services, or third-party applications. An agent (SSM) must be installed on the source to enable sending to CloudWatch. |
|
---|---|---|
Log Storage |
The collected logs are stored in log groups. You can create groups for each application, service, or resource you want to monitor. They are retained for a defined period (from a few days to several years). |
|
Search and Filtering |
You can search and filter your logs using advanced search expressions. | |
Log Visualization | A simple and user-friendly graphical interface is provided to visualize your logs as customizable graphs and dashboards. |
Monitoring through these log files is carried out in near real time, and you can search for keywords, specific phrases, or even values. What’s more, CloudWatch logs can be implemented at no extra cost to your AWS account.
CloudWatch events
They will give you access to near-real-time event streams as your AWS environment evolves. They can then trigger notifications or other automated actions.
The main components of CloudWatch events are as follows:
Les événements | Ils sont générés de 4 manières distinctes, et sont représentés en tant que JSON :
|
|
---|---|---|
Les règles | Elles font correspondre les événements entrants et les redirigent vers une ou plusieurs cibles. Elles ne disposent pas d’ordre de traitement, chaque règle correspondant à un événement sera traitée | |
Les cibles | Elles traitent les événements qui sont spécifiés dans les règles. Initialement, 4 types de cibles existent : intégrés (built-in), les fonctions Lambda, les flux Kinesis et les topics SNS. Une seule règle peut spécifier plusieurs cibles. |
How much does Amazon Cloudwatch cost?
Amazon CloudWatch has a trial period that should enable many common use cases to be met in order to test the service. In addition, most services automatically provide metrics to CloudWatch free of charge.
The free plan (which, incidentally, never expires) gives you access to the following volume:
- 10 custom metrics
- 10 alarms
- One million API requests
- 5GB of storage for log ingestion and 5GB for log archiving
- 3 dashboards, each with 50 metrics per month
There is no minimum charge for the paid plan, and you only pay per use. Pricing for the paid plan differs depending on the AWS region in which you are located. It is therefore advisable to check the pricing in force in your region, and it should be noted that each CloudWatch feature is priced differently.
Conclusion
Amazon CloudWatch is extremely useful when it comes to monitoring and the various tasks involved, which can quickly prove time-consuming and laborious. By allowing administrators to monitor their metrics across a wide range of AWS services (as well as enabling the creation of custom metrics), in conjunction with the use of alarms and notifications, Amazon CloudWatch is a very powerful tool.