AWS CloudWatch monitors AWS resources and your applications on AWS. AWS resources such as EC2 instances, RDS databases, load balancers, etc., can be monitored in real-time with CloudWatch.
The CloudWatch service allows you to collect and track metrics, monitor log files, set alarms, and automatically react to changes in AWS resources. It automatically provides latency, request count, and CPU utilization information. Memory usage, error rates, etc., can also be monitored.
CloudWatch Metrics
CloudWatch metrics provide users with insight into resource utilization, application performance, and operational health. Using these can help you resolve technical issues, streamline processes, and ensure that the application runs smoothly.
Understanding CloudWatch metrics requires understanding the following concepts:
- Namespaces:
A container for CloudWatch metrics. In order to prevent metrics from different applications from accidentally being aggregated for statistics computation, metrics in different namespaces are isolated from each other.
- Metrics:
CloudWatch publishes data points in time-ordered order. In other words, it can be viewed as a variable that we need to monitor, and the data points represent its values over time. - Dimensions:
An identifier for a metric that is either a name or a value pair. The maximum number of dimensions you can assign to a metric is 10. Your statistics plan can be structured using dimensions. - Statistics:
User-specified metric data aggregation over time. The aggregation is based on the namespace, metric name, dimensions, and the data point unit of measure. - Percentiles: A percentile indicates the relative position of a value in a dataset. In this way, you can gain a better understanding of how your metrics are distributed.
- Alarms: Used to initiate actions on your behalf. The alarm monitors a metric over a defined period of time and takes action based on the value of the metric relative to a threshold.
As a metrics repository, CloudWatch can be considered. It is possible to get statistics based on metrics that Amazon services (EC2, RDS, etc.) put into the repository. If you put metrics of custom data into the repository, you get the statistics based on these custom metrics. In the CloudWatch console, you can visualize the statistics obtained. Alarm action can be configured to perform an action on the AWS service (start/stop/terminate). You can also build alerts that start Amazon EC2 Auto Scaling and Amazon Simple Notification Service (SNS) operations.
- Amazon CloudWatch Logs
Access log files from EC2 instances, CloudTrail, Lambda functions, and other sources can be accessed, monitored, and stored using CloudWatch Logs. It is possible to troubleshoot your systems and applications using CloudWatch Logs. Near-real-time monitoring is available, and users can search for specific phrases, values, or patterns. Using AWS, CloudWatch logs can be provisioned as a managed service without any additional purchases. AWS’s console or command-line interface makes it easy to use them. They have deep integration with AWS services. certain logs can trigger alerts when they occur in the logs.Both a unified CloudWatch agent and a CloudWatch Logs agent are offered by AWS for log collection. AWS recommends using the unified CloudWatch agent. The CloudWatch Logs agent automatically creates a log group when it is installed on an EC2 instance. From the AWS console, you can also create a log group. Users can search and filter data based on metrics after the CloudWatch Logs agent publishes log data to Amazon CloudWatch. As log data is transferred to CloudWatch Logs, metric filters specify the patterns and terms to look for. A real-time flow of log events from CloudWatch Logs can be accessed by subscriptions and sent to other services like an Amazon Kinesis Stream, an Amazon Kinesis Data Firehose stream, or an AWS lambda for specialized processing, analysis, or loading to other systems.
- CloudWatch Events
CloudWatch Events allows users to consume a near real-time stream of events as changes to their AWS environment take place. Notifications or other actions may be subsequently triggered by these event changes. An EC2 instance can be started or stopped, and CloudWatch events can identify when an auto-scale event takes place. It can also determine when AWS services are launched or shut off.
The main components of CloudWatch events are:
- Events: generated in four ways. It is represented via small JSON blocks. They can arise from within AWS when a resource changes its state. They may appear when events from API calls and console sign-ins are being sent via CloudTrail to Amazon CloudWatch Events. Another method is to create application-level events using your own code and publish them to Amazon CloudWatch Events for processing. The final option is to schedule their release, with options for periodic or Cron-style scheduling.
- Rules: Transport them to one or more targets or processes by matching incoming events. There is no set order in which rules are processed; all rules that match a specific event are handled.
- Targets: Are outlined in the rules and process events. Built-in, Lambda functions, Kinesis streams, and SNS topics are the four initial target categories. Multiple targets may be specified by a single rule.
CloudWatch helps in reducing the burden of monitoring. It can be used to keep an eye on metrics for a variety of AWS services and, if necessary, develop custom metrics. And when alarms and reactions are used, the administrator has access to a very potent weapon. Additionally, CloudWatch can be incorporated into the current infrastructure.
To learn more about AWS CloudWatch Services, click here
Very Informative…