CloudWatch

Amazon CloudWatch

  • Primary resource monitoring solution for AWS services

  • Collects and tracks metrics for your resources

  • Enables you to create alarms and send notifications based on conditions

  • Can trigger changes in capacity in a resource, based on rules that you set (e.g., Auto Scaling Amazon EC2 instances)

Amazon CloudWatch Components

1. Metrics

Metrics are data about the performance of your systems. Many AWS services provide free metrics for resources by default (such as Amazon EC2 instances, Amazon EBS volumes, and Amazon RDS DB instances).

You can also enable detailed monitoring for some resources, such as your Amazon EC2 instances, or publish your own application metrics.

Amazon CloudWatch can load all the metrics in your account (both AWS resource metrics and application metrics that you provide) for search, graphing, and alarms.

cloud.vn

2. Logs

CloudWatch Logs allows you to monitor, store, and access your log files from sources including Amazon EC2 instances, Route 53, CloudTrail, and other AWS services. For example, you could monitor logs from Amazon EC2 instances in real time. You could track the number of errors that have occurred in your application logs and send a notification if that rate exceeds a previously defined amount.

CloudWatch Logs specifically monitors your log data itself, so no code changes are required.

cloud.vn

3. Alarms

Use an alarm to automatically initiate actions on your behalf. An alarm watches a single metric over a specified time period and performs one or more specified actions, based on the value of the metric relative to a threshold over time. The action is a notification sent to an Amazon SNS topic or an Auto Scaling policy. You can also add alarms to dashboards.

Alarms invoke actions for sustained state changes only. CloudWatch alarms do not invoke actions simply because they are in a particular state. The state must have changed and been maintained for a specified number of periods.

With these examples, the triggering of the alarm would start some other action, such as executing an Auto Scaling policy, sending a notification (to an Ops team, for instance), etc. Actions can also be executed when an alarm is not triggered.

cloud.vn

4. Events

Amazon CloudWatch Events delivers a near real-time stream of system events that describe changes in AWS resources. AWS resources can generate events when their state changes. For example, Amazon EC2 generates an event when the state of an EC2 instance changes from pending to running, and Amazon EC2 Auto Scaling generates events when it launches or terminates instances.

Using simple rules that you can quickly set up, you can match events and route them to one or more target functions or streams.

CloudWatch Events becomes aware of operational changes as they occur. CloudWatch Events responds to these operational changes and takes corrective action as necessary by sending messages to respond to the environment, activating functions, making changes, and capturing state information.

You can also use CloudWatch Events to schedule automated actions that self-trigger at certain times using cron or rate expressions.

cloud.vn

5. Rules

A rule matches incoming events and routes them to targets for processing. A single rule can route to multiple targets, all of which are processed in parallel.

Rules are not processed in a particular order. This enables different parts of an organization to look for and process the events that are of interest to them. A rule can customize the JSON message sent to the target by passing only certain parts or by overwriting it with a constant.

cloud.vn

6. Targets

A target processes events. Targets can include Amazon EC2 instances, AWS Lambda functions, Kinesis data streams, Amazon ECS tasks, Step Functions state machines, Amazon SNS topics, Amazon SQS queues, and built-in targets. A target receives events in JSON format.

cloud.vn