AWS Fundamentals Logo
AWS Fundamentals
L2 Construct

Alarm

An alarm on a CloudWatch metric.

Import

import { Alarm } from 'aws-cdk-lib/aws-cloudwatch';

Or use the module namespace:

import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';
// cloudwatch.Alarm

Properties

Configuration passed to the constructor as AlarmProps.

metricRequired
IMetric

The metric to add the alarm on. Metric objects can be obtained from most resources, or you can construct custom Metric objects by instantiating one.

9 properties inherited from CreateAlarmOptions
evaluationPeriodsRequiredinherited from CreateAlarmOptions
number

The number of periods over which data is compared to the specified threshold.

thresholdRequiredinherited from CreateAlarmOptions
number

The value against which the specified statistic is compared.

actionsEnabledOptionalinherited from CreateAlarmOptions
boolean

Whether the actions for this alarm are enabled.

Default: true

alarmDescriptionOptionalinherited from CreateAlarmOptions
string

Description for the alarm.

Default: No description

alarmNameOptionalinherited from CreateAlarmOptions
string

Name of the alarm.

Default: Automatically generated name

comparisonOperatorOptionalinherited from CreateAlarmOptions
ComparisonOperator

Comparison to use to check if metric is breaching.

Default: GreaterThanOrEqualToThreshold

datapointsToAlarmOptionalinherited from CreateAlarmOptions
number

The number of datapoints that must be breaching to trigger the alarm. This is used only if you are setting an "M out of N" alarm. In that case, this value is the M. For more information, see Evaluating an Alarm in the Amazon CloudWatch User Guide.

Default: ``evaluationPeriods``

evaluateLowSampleCountPercentileOptionalinherited from CreateAlarmOptions
string

Specifies whether to evaluate the data and potentially change the alarm state if there are too few data points to be statistically significant. Used only for alarms that are based on percentiles.

Default: - Not configured.

treatMissingDataOptionalinherited from CreateAlarmOptions
TreatMissingData

Sets how this alarm is to handle missing data points.

Default: TreatMissingData.Missing

Get the Amazon CloudWatch Cheat Sheet

Everything you need to know about Amazon CloudWatch on one page. HD quality, print-friendly.

Download Free Infographic