CloudWatch Concepts

Metrics

  • Metrics are the fundamental concept in CloudWatch.

  • A metric represents a time-ordered set of data points that are published to CloudWatch.

  • Think of a metric as a variable to monitor, and the data points as representing the values of that variable over time.

    • For example, the CPU usage of a particular EC2 instance is one metric provided by EC2.

  • By default, many AWS services provide free metrics for resources (such as Amazon EC2 instances, Amazon EBS volumes, and Amazon RDS DB instances).

  • For a charge, you can also enable detailed monitoring for some resources.

  • For custom metrics, you can add the data points in any order, and at any rate you choose.

  • Metrics exist only in the Region in which they are created.

  • Each data point in a metric has a time stamp, and (optionally) a unit of measure.

Dimensions

  • A dimension is a name/value pair that is part of the identity of a metric.

  • You can assign up to 10 dimensions to a metric.

  • Think of dimensions as categories for those metrics.

Namespaces

  • A namespace is a container for CloudWatch metrics.

  • Metrics in different namespaces are isolated from each other, so that metrics from different applications are not mistakenly aggregated into the same statistics.

  • There is no default namespace.

    • You must specify a namespace for each data point you publish to CloudWatch.

Resolution

  • Standard resolution = one-minute granularity.

  • High resolution = granularity of one second.

  • EC2 Basic monitoring = Metrics every 5 minutes.

  • EC2 Detailed monitoring = Metrics every minute; it is a paid option.

Custom Metrics

  • You can define custom metrics for your own use.

  • Once Amazon CloudWatch contains your custom metrics, you can view those in the CloudWatch console.

  • Uses API called PutMetricData.

CloudWatch Alarms

  • You can 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.

  • When creating an alarm, select an alarm monitoring period that is greater than or equal to the metric's resolution.

    • For example, basic monitoring for EC2 is metrics every 5 minutes.

      • So, when setting an alarm, select a period greater than 5 minutes.

  • An alarm can be in three possible states:

    • OK - The metric or expression is within the defined threshold.

    • ALARM - The metric or expression is outside of the defined threshold.

    • INSUFFICIENT_DATA - The alarm has just started, the metric is not available, or not enough data is available for the metric to determine the alarm state.

Last updated