CfnAlarmProps Struct
Properties for defining a CfnAlarm.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_cloudwatch as cloudwatch } from 'aws-cdk-lib';
declare const slidingWindow: any;
const cfnAlarmProps: cloudwatch.CfnAlarmProps = {
actionsEnabled: false,
alarmActions: ['alarmActions'],
alarmDescription: 'alarmDescription',
alarmName: 'alarmName',
comparisonOperator: 'comparisonOperator',
datapointsToAlarm: 123,
dimensions: [{
name: 'name',
value: 'value',
}],
evaluateLowSampleCountPercentile: 'evaluateLowSampleCountPercentile',
evaluationCriteria: {
promQlCriteria: {
pendingPeriod: 123,
query: 'query',
recoveryPeriod: 123,
},
},
evaluationInterval: 123,
evaluationPeriods: 123,
evaluationWindow: {
slidingWindow: slidingWindow,
wallClockWindow: {
timezone: 'timezone',
},
},
extendedStatistic: 'extendedStatistic',
insufficientDataActions: ['insufficientDataActions'],
metricName: 'metricName',
metrics: [{
id: 'id',
// the properties below are optional
accountId: 'accountId',
expression: 'expression',
label: 'label',
metricStat: {
metric: {
dimensions: [{
name: 'name',
value: 'value',
}],
metricName: 'metricName',
namespace: 'namespace',
},
period: 123,
stat: 'stat',
// the properties below are optional
unit: 'unit',
},
period: 123,
returnData: false,
}],
namespace: 'namespace',
okActions: ['okActions'],
period: 123,
statistic: 'statistic',
tags: [{
key: 'key',
value: 'value',
}],
threshold: 123,
thresholdMetricId: 'thresholdMetricId',
treatMissingData: 'treatMissingData',
unit: 'unit',
warmUpConfiguration: {
onlyStartEvaluatingAfterWarmUpPeriodEnds: false,
warmUpPeriodDurationInMinutes: 123,
},
};
Properties
actionsEnabledboolean | IResolvableactions_enabledtyping.Union[bool, IResolvable]actionsEnabledBooleanActionsEnabledboolActionsEnabledinterface{}= true#The default is TRUE.
alarmActionsstring | IScalingPolicyRef | ITopicRef[]alarm_actionstyping.List[typing.Union[str, IScalingPolicyRef, ITopicRef]]alarmActionsList<String>AlarmActionsstring[]AlarmActions*[]interface{}#notes
Specify each action as an Amazon Resource Name (ARN). For more information about creating alarms and the actions that you can specify, see PutMetricAlarm in the Amazon CloudWatch API Reference .
alarmDescriptionstringalarm_descriptionstralarmDescriptionStringAlarmDescriptionstringAlarmDescription*string#notes
If you don't specify a name, CloudFormation generates a unique physical ID and uses that ID for the alarm name.
If you specify a name, you cannot perform updates that require replacement of this resource. You can perform updates that require no or some interruption. If you must replace the resource, specify a new name.
comparisonOperatorstringcomparison_operatorstrcomparisonOperatorStringComparisonOperatorstringComparisonOperator*string#The specified statistic value is used as the first operand.
datapointsToAlarmnumberdatapoints_to_alarmint | floatdatapointsToAlarmNumberDatapointsToAlarmdoubleDatapointsToAlarm*float64#notes
This is used only if you are setting an "M out of N" alarm. In that case, this value is the M, and the value that you set for EvaluationPeriods is the N value. For more information, see Evaluating an Alarm in the Amazon CloudWatch User Guide .
If you omit this parameter, CloudWatch uses the same value here that you set for EvaluationPeriods , and the alarm goes to alarm state if that many consecutive periods are breaching.
dimensionsIResolvable | IResolvable | CfnAlarm.DimensionProperty[]dimensionstyping.Union[IResolvable, typing.List[typing.Union[IResolvable, DimensionProperty]]]dimensionsIResolvableDimensionsIResolvableDimensionsinterface{}#For an alarm based on a math expression, you can't specify Dimensions . Instead, you use Metrics .
evaluateLowSampleCountPercentilestringevaluate_low_sample_count_percentilestrevaluateLowSampleCountPercentileStringEvaluateLowSampleCountPercentilestringEvaluateLowSampleCountPercentile*string#notes
If ignore , the alarm state does not change during periods with too few data points to be statistically significant. If evaluate or this parameter is not used, the alarm is always evaluated and possibly changes state no matter how many data points are available.
evaluationCriteriaIResolvable | CfnAlarm.EvaluationCriteriaPropertyevaluation_criteriatyping.Union[IResolvable, EvaluationCriteriaProperty]evaluationCriteriaIResolvableEvaluationCriteriaIResolvableEvaluationCriteriainterface{}#This is a union type that currently supports PromQLCriteria.
evaluationIntervalnumberevaluation_intervalint | floatevaluationIntervalNumberEvaluationIntervaldoubleEvaluationInterval*float64#evaluationPeriodsnumberevaluation_periodsint | floatevaluationPeriodsNumberEvaluationPeriodsdoubleEvaluationPeriods*float64#notes
If you are setting an alarm that requires that a number of consecutive data points be breaching to trigger the alarm, this value specifies that number. If you are setting an "M out of N" alarm, this value is the N, and DatapointsToAlarm is the M.
For more information, see Evaluating an Alarm in the Amazon CloudWatch User Guide .
evaluationWindowIResolvable | CfnAlarm.EvaluationWindowPropertyevaluation_windowtyping.Union[IResolvable, EvaluationWindowProperty]evaluationWindowIResolvableEvaluationWindowIResolvableEvaluationWindowinterface{}#notes
This is a union type. Set exactly one of its members, SlidingWindow or WallClockWindow. If you don't set EvaluationWindow, the alarm uses a SlidingWindow by default. For more information, see Alarm evaluation windows in the CloudWatch User Guide.
extendedStatisticstringextended_statisticstrextendedStatisticStringExtendedStatisticstringExtendedStatistic*string#For an alarm based on a metric, you must specify either Statistic or ExtendedStatistic but not both.
For an alarm based on a math expression, you can't specify ExtendedStatistic . Instead, you use Metrics .
insufficientDataActionsstring | ITopicRef[]insufficient_data_actionstyping.List[typing.Union[str, ITopicRef]]insufficientDataActionsList<String>InsufficientDataActionsstring[]InsufficientDataActions*[]interface{}#Each action is specified as an Amazon Resource Name (ARN).
This is required for an alarm based on a metric. For an alarm based on a math expression, you use Metrics instead and you can't specify MetricName .
metricsIResolvable | IResolvable | CfnAlarm.MetricDataQueryProperty[]metricstyping.Union[IResolvable, typing.List[typing.Union[IResolvable, MetricDataQueryProperty]]]metricsIResolvableMetricsIResolvableMetricsinterface{}#notes
Each item in the array either retrieves a metric or performs a math expression.
If you specify the Metrics parameter, you cannot specify MetricName , Dimensions , Period , Namespace , Statistic , ExtendedStatistic , or Unit .
notes
This is required for an alarm based on a metric. For an alarm based on a math expression, you can't specify Namespace and you use Metrics instead.
For a list of namespaces for metrics from AWS services, see AWS Services That Publish CloudWatch Metrics.
okActionsstring | ITopicRef[]ok_actionstyping.List[typing.Union[str, ITopicRef]]okActionsList<String>OkActionsstring[]OkActions*[]interface{}#Each action is specified as an Amazon Resource Name (ARN).
This is required for an alarm based on a metric. Valid values are 10, 20, 30, 60, and any multiple of 60.
For an alarm based on a math expression, you can't specify Period , and instead you use the Metrics parameter.
Minimum: 10
For an alarm based on a metric, you must specify either Statistic or ExtendedStatistic but not both.
For an alarm based on a math expression, you can't specify Statistic . Instead, you use Metrics .
notes
You can associate as many as 50 tags with an alarm. To be able to associate tags with the alarm when you create the alarm, you must have the cloudwatch:TagResource permission.
Tags can help you organize and categorize your resources. You can also use them to scope user permissions by granting a user permission to access or change only resources with certain tag values.
thresholdMetricIdstringthreshold_metric_idstrthresholdMetricIdStringThresholdMetricIdstringThresholdMetricId*string#treatMissingDatastringtreat_missing_datastrtreatMissingDataStringTreatMissingDatastringTreatMissingData*string#notes
Valid values are breaching , notBreaching , ignore , and missing . For more information, see Configuring How CloudWatch Alarms Treat Missing Data in the Amazon CloudWatch User Guide .
If you omit this parameter, the default behavior of missing is used.
notes
Specify this only if you are creating an alarm based on a single metric. Do not specify this if you are specifying a Metrics array.
You can specify the following values: Seconds, Microseconds, Milliseconds, Bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, Bits, Kilobits, Megabits, Gigabits, Terabits, Percent, Count, Bytes/Second, Kilobytes/Second, Megabytes/Second, Gigabytes/Second, Terabytes/Second, Bits/Second, Kilobits/Second, Megabits/Second, Gigabits/Second, Terabits/Second, Count/Second, or None.
warmUpConfigurationIResolvable | CfnAlarm.WarmUpConfigurationPropertywarm_up_configurationtyping.Union[IResolvable, WarmUpConfigurationProperty]warmUpConfigurationIResolvableWarmUpConfigurationIResolvableWarmUpConfigurationinterface{}#notes
Use these settings to delay alarm evaluation after you create or update the alarm, which reduces alarm noise while a new resource or service starts publishing data. During the warm-up period, the alarm stays in INSUFFICIENT_DATA and does not perform alarm actions.