# CfnAlarm

L1 construct · External

The `AWS::CloudWatch::Alarm` type specifies an alarm and associates it with the specified metric or metric math expression.

When this operation creates an alarm, the alarm state is immediately set to `INSUFFICIENT_DATA` . The alarm is then evaluated and its state is set appropriately. Any actions associated with the new state are then executed.

When you update an existing alarm, its state is left unchanged, but the update completely overwrites the previous configuration of the alarm.

Extends: [Construct](https://docs.aws.amazon.com/cdk/api/v2/docs/constructs.Construct.html) › [CfnElement](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.CfnElement.html) › [CfnRefElement](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.CfnRefElement.html) › [CfnResource](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.CfnResource.html) › CfnAlarm
Implements: [IInspectable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IInspectable.html), [ITaggableV2](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.ITaggableV2.html), [IEnvironmentAware](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.IEnvironmentAware.html), [IAlarmRef](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_cloudwatch.IAlarmRef.html), [IConstruct](https://docs.aws.amazon.com/cdk/api/v2/docs/constructs.IConstruct.html), IDependable

- CloudFormation: [`AWS::CloudWatch::Alarm`](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-cloudwatch-alarm.html)
- Source: Generated at build time
- Type last changed: v2.275.0 · 26 Oct 2026

## Example

TypeScript:

```ts
// 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 cfnAlarm = new cloudwatch.CfnAlarm(this, 'MyCfnAlarm', /* all optional props */ {
  actionConfiguration: {
    alarmTagsPropagation: {
      enabled: false,

      // the properties below are optional
      excludedTagKeys: ['excludedTagKeys'],
      includedTagKeys: ['includedTagKeys'],
    },
  },
  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,
  },
});
```

Python:

```python
from aws_cdk import CfnTag
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_cloudwatch as cloudwatch

# sliding_window: Any

cfn_alarm = cloudwatch.CfnAlarm(self, "MyCfnAlarm",
    action_configuration=cloudwatch.CfnAlarm.ActionConfigurationProperty(
        alarm_tags_propagation=cloudwatch.CfnAlarm.AlarmTagsPropagationProperty(
            enabled=False,

            # the properties below are optional
            excluded_tag_keys=["excludedTagKeys"],
            included_tag_keys=["includedTagKeys"]
        )
    ),
    actions_enabled=False,
    alarm_actions=["alarmActions"],
    alarm_description="alarmDescription",
    alarm_name="alarmName",
    comparison_operator="comparisonOperator",
    datapoints_to_alarm=123,
    dimensions=[cloudwatch.CfnAlarm.DimensionProperty(
        name="name",
        value="value"
    )],
    evaluate_low_sample_count_percentile="evaluateLowSampleCountPercentile",
    evaluation_criteria=cloudwatch.CfnAlarm.EvaluationCriteriaProperty(
        prom_ql_criteria=cloudwatch.CfnAlarm.AlarmPromQLCriteriaProperty(
            pending_period=123,
            query="query",
            recovery_period=123
        )
    ),
    evaluation_interval=123,
    evaluation_periods=123,
    evaluation_window=cloudwatch.CfnAlarm.EvaluationWindowProperty(
        sliding_window=sliding_window,
        wall_clock_window=cloudwatch.CfnAlarm.WallClockWindowProperty(
            timezone="timezone"
        )
    ),
    extended_statistic="extendedStatistic",
    insufficient_data_actions=["insufficientDataActions"],
    metric_name="metricName",
    metrics=[cloudwatch.CfnAlarm.MetricDataQueryProperty(
        id="id",

        # the properties below are optional
        account_id="accountId",
        expression="expression",
        label="label",
        metric_stat=cloudwatch.CfnAlarm.MetricStatProperty(
            metric=cloudwatch.CfnAlarm.MetricProperty(
                dimensions=[cloudwatch.CfnAlarm.DimensionProperty(
                    name="name",
                    value="value"
                )],
                metric_name="metricName",
                namespace="namespace"
            ),
            period=123,
            stat="stat",

            # the properties below are optional
            unit="unit"
        ),
        period=123,
        return_data=False
    )],
    namespace="namespace",
    ok_actions=["okActions"],
    period=123,
    statistic="statistic",
    tags=[CfnTag(
        key="key",
        value="value"
    )],
    threshold=123,
    threshold_metric_id="thresholdMetricId",
    treat_missing_data="treatMissingData",
    unit="unit",
    warm_up_configuration=cloudwatch.CfnAlarm.WarmUpConfigurationProperty(
        only_start_evaluating_after_warm_up_period_ends=False,
        warm_up_period_duration_in_minutes=123
    )
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.cloudwatch.*;

Object slidingWindow;

CfnAlarm cfnAlarm = CfnAlarm.Builder.create(this, "MyCfnAlarm")
        .actionConfiguration(ActionConfigurationProperty.builder()
                .alarmTagsPropagation(AlarmTagsPropagationProperty.builder()
                        .enabled(false)

                        // the properties below are optional
                        .excludedTagKeys(List.of("excludedTagKeys"))
                        .includedTagKeys(List.of("includedTagKeys"))
                        .build())
                .build())
        .actionsEnabled(false)
        .alarmActions(List.of("alarmActions"))
        .alarmDescription("alarmDescription")
        .alarmName("alarmName")
        .comparisonOperator("comparisonOperator")
        .datapointsToAlarm(123)
        .dimensions(List.of(DimensionProperty.builder()
                .name("name")
                .value("value")
                .build()))
        .evaluateLowSampleCountPercentile("evaluateLowSampleCountPercentile")
        .evaluationCriteria(EvaluationCriteriaProperty.builder()
                .promQlCriteria(AlarmPromQLCriteriaProperty.builder()
                        .pendingPeriod(123)
                        .query("query")
                        .recoveryPeriod(123)
                        .build())
                .build())
        .evaluationInterval(123)
        .evaluationPeriods(123)
        .evaluationWindow(EvaluationWindowProperty.builder()
                .slidingWindow(slidingWindow)
                .wallClockWindow(WallClockWindowProperty.builder()
                        .timezone("timezone")
                        .build())
                .build())
        .extendedStatistic("extendedStatistic")
        .insufficientDataActions(List.of("insufficientDataActions"))
        .metricName("metricName")
        .metrics(List.of(MetricDataQueryProperty.builder()
                .id("id")

                // the properties below are optional
                .accountId("accountId")
                .expression("expression")
                .label("label")
                .metricStat(MetricStatProperty.builder()
                        .metric(MetricProperty.builder()
                                .dimensions(List.of(DimensionProperty.builder()
                                        .name("name")
                                        .value("value")
                                        .build()))
                                .metricName("metricName")
                                .namespace("namespace")
                                .build())
                        .period(123)
                        .stat("stat")

                        // the properties below are optional
                        .unit("unit")
                        .build())
                .period(123)
                .returnData(false)
                .build()))
        .namespace("namespace")
        .okActions(List.of("okActions"))
        .period(123)
        .statistic("statistic")
        .tags(List.of(CfnTag.builder()
                .key("key")
                .value("value")
                .build()))
        .threshold(123)
        .thresholdMetricId("thresholdMetricId")
        .treatMissingData("treatMissingData")
        .unit("unit")
        .warmUpConfiguration(WarmUpConfigurationProperty.builder()
                .onlyStartEvaluatingAfterWarmUpPeriodEnds(false)
                .warmUpPeriodDurationInMinutes(123)
                .build())
        .build();
```

C#:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.CloudWatch;

var slidingWindow;

var cfnAlarm = new CfnAlarm(this, "MyCfnAlarm", new CfnAlarmProps {
    ActionConfiguration = new ActionConfigurationProperty {
        AlarmTagsPropagation = new AlarmTagsPropagationProperty {
            Enabled = false,

            // the properties below are optional
            ExcludedTagKeys = new [] { "excludedTagKeys" },
            IncludedTagKeys = new [] { "includedTagKeys" }
        }
    },
    ActionsEnabled = false,
    AlarmActions = new [] { "alarmActions" },
    AlarmDescription = "alarmDescription",
    AlarmName = "alarmName",
    ComparisonOperator = "comparisonOperator",
    DatapointsToAlarm = 123,
    Dimensions = new [] { new DimensionProperty {
        Name = "name",
        Value = "value"
    } },
    EvaluateLowSampleCountPercentile = "evaluateLowSampleCountPercentile",
    EvaluationCriteria = new EvaluationCriteriaProperty {
        PromQlCriteria = new AlarmPromQLCriteriaProperty {
            PendingPeriod = 123,
            Query = "query",
            RecoveryPeriod = 123
        }
    },
    EvaluationInterval = 123,
    EvaluationPeriods = 123,
    EvaluationWindow = new EvaluationWindowProperty {
        SlidingWindow = slidingWindow,
        WallClockWindow = new WallClockWindowProperty {
            Timezone = "timezone"
        }
    },
    ExtendedStatistic = "extendedStatistic",
    InsufficientDataActions = new [] { "insufficientDataActions" },
    MetricName = "metricName",
    Metrics = new [] { new MetricDataQueryProperty {
        Id = "id",

        // the properties below are optional
        AccountId = "accountId",
        Expression = "expression",
        Label = "label",
        MetricStat = new MetricStatProperty {
            Metric = new MetricProperty {
                Dimensions = new [] { new DimensionProperty {
                    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 = new [] { "okActions" },
    Period = 123,
    Statistic = "statistic",
    Tags = new [] { new CfnTag {
        Key = "key",
        Value = "value"
    } },
    Threshold = 123,
    ThresholdMetricId = "thresholdMetricId",
    TreatMissingData = "treatMissingData",
    Unit = "unit",
    WarmUpConfiguration = new WarmUpConfigurationProperty {
        OnlyStartEvaluatingAfterWarmUpPeriodEnds = false,
        WarmUpPeriodDurationInMinutes = 123
    }
});
```

Go:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

var slidingWindow interface{}

cfnAlarm := awscdk.Aws_cloudwatch.NewCfnAlarm(this, jsii.String("MyCfnAlarm"), &CfnAlarmProps{
	ActionConfiguration: &ActionConfigurationProperty{
		AlarmTagsPropagation: &AlarmTagsPropagationProperty{
			Enabled: jsii.Boolean(false),

			// the properties below are optional
			ExcludedTagKeys: []*string{
				jsii.String("excludedTagKeys"),
			},
			IncludedTagKeys: []*string{
				jsii.String("includedTagKeys"),
			},
		},
	},
	ActionsEnabled: jsii.Boolean(false),
	AlarmActions: []interface{}{
		jsii.String("alarmActions"),
	},
	AlarmDescription: jsii.String("alarmDescription"),
	AlarmName: jsii.String("alarmName"),
	ComparisonOperator: jsii.String("comparisonOperator"),
	DatapointsToAlarm: jsii.Number(123),
	Dimensions: []interface{}{
		&DimensionProperty{
			Name: jsii.String("name"),
			Value: jsii.String("value"),
		},
	},
	EvaluateLowSampleCountPercentile: jsii.String("evaluateLowSampleCountPercentile"),
	EvaluationCriteria: &EvaluationCriteriaProperty{
		PromQlCriteria: &AlarmPromQLCriteriaProperty{
			PendingPeriod: jsii.Number(123),
			Query: jsii.String("query"),
			RecoveryPeriod: jsii.Number(123),
		},
	},
	EvaluationInterval: jsii.Number(123),
	EvaluationPeriods: jsii.Number(123),
	EvaluationWindow: &EvaluationWindowProperty{
		SlidingWindow: slidingWindow,
		WallClockWindow: &WallClockWindowProperty{
			Timezone: jsii.String("timezone"),
		},
	},
	ExtendedStatistic: jsii.String("extendedStatistic"),
	InsufficientDataActions: []interface{}{
		jsii.String("insufficientDataActions"),
	},
	MetricName: jsii.String("metricName"),
	Metrics: []interface{}{
		&MetricDataQueryProperty{
			Id: jsii.String("id"),

			// the properties below are optional
			AccountId: jsii.String("accountId"),
			Expression: jsii.String("expression"),
			Label: jsii.String("label"),
			MetricStat: &MetricStatProperty{
				Metric: &MetricProperty{
					Dimensions: []interface{}{
						&DimensionProperty{
							Name: jsii.String("name"),
							Value: jsii.String("value"),
						},
					},
					MetricName: jsii.String("metricName"),
					Namespace: jsii.String("namespace"),
				},
				Period: jsii.Number(123),
				Stat: jsii.String("stat"),

				// the properties below are optional
				Unit: jsii.String("unit"),
			},
			Period: jsii.Number(123),
			ReturnData: jsii.Boolean(false),
		},
	},
	Namespace: jsii.String("namespace"),
	OkActions: []interface{}{
		jsii.String("okActions"),
	},
	Period: jsii.Number(123),
	Statistic: jsii.String("statistic"),
	Tags: []CfnTag{
		&CfnTag{
			Key: jsii.String("key"),
			Value: jsii.String("value"),
		},
	},
	Threshold: jsii.Number(123),
	ThresholdMetricId: jsii.String("thresholdMetricId"),
	TreatMissingData: jsii.String("treatMissingData"),
	Unit: jsii.String("unit"),
	WarmUpConfiguration: &WarmUpConfigurationProperty{
		OnlyStartEvaluatingAfterWarmUpPeriodEnds: jsii.Boolean(false),
		WarmUpPeriodDurationInMinutes: jsii.Number(123),
	},
})
```

## Initializer

TypeScript:

```ts
new CfnAlarm(scope: Construct, id: string, props?: CfnAlarmProps)
```

Python:

```python
CfnAlarm(scope: Construct, id: str, props: typing.Optional[CfnAlarmProps] = None)
```

Java:

```java
new CfnAlarm(Construct scope, String id, CfnAlarmProps props)
```

C#:

```csharp
new CfnAlarm(Construct scope, string id, CfnAlarmProps? props = null)
```

Go:

```go
NewCfnAlarm(Scope Construct, Id *string, Props CfnAlarmProps)
```

## Construct Props

- `actionConfiguration`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnAlarm.ActionConfigurationProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudwatch.CfnAlarm.ActionConfigurationProperty.html)

- `actionsEnabled`: boolean | [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) = true — Indicates whether actions should be executed during any changes to the alarm state.

  The default is TRUE.

- `alarmActions`: string | [IScalingPolicyRef](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_autoscaling.IScalingPolicyRef.html) | [ITopicRef](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_sns.ITopicRef.html)[] — The list of actions to execute when this alarm transitions into an ALARM state from any other state.

  Specify each action as an Amazon Resource Name (ARN). For more information about creating alarms and the actions that you can specify, see [PutMetricAlarm](https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_PutMetricAlarm.html) in the *Amazon CloudWatch API Reference* .

- `alarmDescription`: string — The description of the alarm.

- `alarmName`: string — The name of the alarm.

  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.

- `comparisonOperator`: string — The arithmetic operation to use when comparing the specified statistic and threshold.

  The specified statistic value is used as the first operand.

- `datapointsToAlarm`: 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, and the value that you set for `EvaluationPeriods` is the N value. For more information, see [Evaluating an Alarm](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#alarm-evaluation) 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.

- `dimensions`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnAlarm.DimensionProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudwatch.CfnAlarm.DimensionProperty.html)[] — The dimensions for the metric associated with the alarm.

  For an alarm based on a math expression, you can't specify `Dimensions` . Instead, you use `Metrics` .

- `evaluateLowSampleCountPercentile`: string — Used only for alarms based on percentiles.

  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.

- `evaluationCriteria`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnAlarm.EvaluationCriteriaProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudwatch.CfnAlarm.EvaluationCriteriaProperty.html) — The evaluation criteria for an alarm.

  This is a union type that currently supports ``PromQLCriteria``.

- `evaluationInterval`: number — The frequency, in seconds, at which the alarm is evaluated.

- `evaluationPeriods`: number — The number of periods over which data is compared to the specified threshold.

  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](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#alarm-evaluation) in the *Amazon CloudWatch User Guide* .

- `evaluationWindow`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnAlarm.EvaluationWindowProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudwatch.CfnAlarm.EvaluationWindowProperty.html) — The evaluation window that an alarm uses to select the range of metric data that it evaluates each time it runs.

  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](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/alarm-evaluation-window.html) in the *CloudWatch User Guide*.

- `extendedStatistic`: string — The percentile statistic for the metric associated with the alarm. Specify a value between p0.0 and p100.

  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` .

- `insufficientDataActions`: string | [ITopicRef](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_sns.ITopicRef.html)[] — The actions to execute when this alarm transitions to the `INSUFFICIENT_DATA` state from any other state.

  Each action is specified as an Amazon Resource Name (ARN).

- `metricName`: string — The name of the metric associated with the alarm.

  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` .

- `metrics`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnAlarm.MetricDataQueryProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudwatch.CfnAlarm.MetricDataQueryProperty.html)[] — An array that enables you to create an alarm based on the result of a metric math expression.

  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` .

- `namespace`: string — The namespace of the metric associated with the alarm.

  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.](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/aws-services-cloudwatch-metrics.html)

- `okActions`: string | [ITopicRef](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_sns.ITopicRef.html)[] — The actions to execute when this alarm transitions to the `OK` state from any other state.

  Each action is specified as an Amazon Resource Name (ARN).

- `period`: number — The period, in seconds, over which the statistic is applied.

  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

- `statistic`: string — The statistic for the metric associated with the alarm, other than percentile. For percentile statistics, use `ExtendedStatistic` .

  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` .

- `tags`: [CfnTag](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.CfnTag.html)[] — A list of key-value pairs to associate with the alarm.

  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.

- `threshold`: number — The value to compare with the specified statistic.

- `thresholdMetricId`: string — In an alarm based on an anomaly detection model, this is the ID of the `ANOMALY_DETECTION_BAND` function used as the threshold for the alarm.

- `treatMissingData`: string — Sets how this alarm is to handle missing data points.

  Valid values are `breaching` , `notBreaching` , `ignore` , and `missing` . For more information, see [Configuring How CloudWatch Alarms Treat Missing Data](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#alarms-and-missing-data) in the *Amazon CloudWatch User Guide* .

  If you omit this parameter, the default behavior of `missing` is used.

- `unit`: string — The unit of the metric associated with the alarm.

  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.

- `warmUpConfiguration`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnAlarm.WarmUpConfigurationProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudwatch.CfnAlarm.WarmUpConfigurationProperty.html) — The configuration settings that define the warm-up behavior for an alarm.

  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.

## Properties

- `actionConfiguration`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnAlarm.ActionConfigurationProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudwatch.CfnAlarm.ActionConfigurationProperty.html)

- `actionsEnabled`: boolean | [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) — Indicates whether actions should be executed during any changes to the alarm state.

- `alarmActions`: string[] — The list of actions to execute when this alarm transitions into an ALARM state from any other state.

- `alarmDescription`: string — The description of the alarm.

- `alarmName`: string — The name of the alarm.

- `alarmRef`: [AlarmReference](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_cloudwatch.AlarmReference.html) — A reference to a Alarm resource.

- `attrArn`: string — The ARN of the CloudWatch alarm, such as `arn:aws:cloudwatch:us-west-2:123456789012:alarm:myCloudWatchAlarm-CPUAlarm-UXMMZK36R55Z` .

- `cdkTagManager`: [TagManager](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.TagManager.html) — Tag Manager which manages the tags for this resource.

- `CFN_RESOURCE_TYPE_NAME`: string (static) — The CloudFormation resource type name for this resource class.

- `cfnOptions`: [ICfnResourceOptions](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.ICfnResourceOptions.html) — Options for this resource, such as condition, update policy etc.

- `cfnResourceType`: string — AWS resource type.

- `comparisonOperator`: string — The arithmetic operation to use when comparing the specified statistic and threshold.

- `creationStack`: string[]

- `datapointsToAlarm`: number — The number of datapoints that must be breaching to trigger the alarm.

- `dimensions`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnAlarm.DimensionProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudwatch.CfnAlarm.DimensionProperty.html)[] — The dimensions for the metric associated with the alarm.

- `env`: [ResourceEnvironment](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.ResourceEnvironment.html)

- `evaluateLowSampleCountPercentile`: string — Used only for alarms based on percentiles.

- `evaluationCriteria`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnAlarm.EvaluationCriteriaProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudwatch.CfnAlarm.EvaluationCriteriaProperty.html) — The evaluation criteria for an alarm.

- `evaluationInterval`: number — The frequency, in seconds, at which the alarm is evaluated.

- `evaluationPeriods`: number — The number of periods over which data is compared to the specified threshold.

- `evaluationWindow`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnAlarm.EvaluationWindowProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudwatch.CfnAlarm.EvaluationWindowProperty.html) — The evaluation window that an alarm uses to select the range of metric data that it evaluates each time it runs.

- `extendedStatistic`: string — The percentile statistic for the metric associated with the alarm.

  Specify a value between p0.0 and p100.

- `insufficientDataActions`: string[] — The actions to execute when this alarm transitions to the `INSUFFICIENT_DATA` state from any other state.

- `logicalId`: string — The logical ID for this CloudFormation stack element.

  The logical ID of the element
  is calculated from the path of the resource node in the construct tree.

  To override this value, use `overrideLogicalId(newLogicalId)`.

- `metricName`: string — The name of the metric associated with the alarm.

- `metrics`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnAlarm.MetricDataQueryProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudwatch.CfnAlarm.MetricDataQueryProperty.html)[] — An array that enables you to create an alarm based on the result of a metric math expression.

- `namespace`: string — The namespace of the metric associated with the alarm.

- `node`: [Node](https://docs.aws.amazon.com/cdk/api/v2/docs/constructs.Node.html) — The tree node.

- `okActions`: string[] — The actions to execute when this alarm transitions to the `OK` state from any other state.

- `period`: number — The period, in seconds, over which the statistic is applied.

- `ref`: string — Return a string that will be resolved to a CloudFormation `{ Ref }` for this element.

  If, by any chance, the intrinsic reference of a resource is not a string, you could
  coerce it to an IResolvable through `Lazy.any({ produce: resource.ref })`.

- `stack`: [Stack](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Stack.html) — The stack in which this element is defined.

  CfnElements must be defined within a stack scope (directly or indirectly).

- `statistic`: string — The statistic for the metric associated with the alarm, other than percentile.

  For percentile statistics, use `ExtendedStatistic` .

- `tags`: [CfnTag](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.CfnTag.html)[] — A list of key-value pairs to associate with the alarm.

- `threshold`: number — The value to compare with the specified statistic.

- `thresholdMetricId`: string — In an alarm based on an anomaly detection model, this is the ID of the `ANOMALY_DETECTION_BAND` function used as the threshold for the alarm.

- `treatMissingData`: string — Sets how this alarm is to handle missing data points.

- `unit`: string — The unit of the metric associated with the alarm.

- `warmUpConfiguration`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnAlarm.WarmUpConfigurationProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudwatch.CfnAlarm.WarmUpConfigurationProperty.html) — The configuration settings that define the warm-up behavior for an alarm.

## Methods

- `addDeletionOverride(path: string): void` — Syntactic sugar for `addOverride(path, undefined)`.

  **Parameters**

  - `path` — The path of the value to delete.

- `addDependency(target: CfnResource): void` — Use `addResourceDependency` instead.

  This method has been renamed to `addResourceDependency` to more clearly
  set it apart from `construct.node.addDependency`. See the documentation
  of that function for more details.

- `addDependsOn(target: CfnResource): void` — Use `addResourceDependency` instead.

  This can be used for resources across stacks (or nested stack) boundaries
  and the dependency will automatically be transferred to the relevant scope.

  This method has been renamed to `addResourceDependency`, which makes it
  more clear that this method operates at a different level from the
  construct-level `construct.node.addDependency()` mechanism.

- `addMetadata(key: string, value: any): void` — Add a value to the CloudFormation Resource Metadata.

- `addOverride(path: string, value: any): void` — Adds an override to the synthesized CloudFormation resource.

  To add a
  property override, either use `addPropertyOverride` or prefix `path` with
  "Properties." (i.e. `Properties.TopicName`).

  If the override is nested, separate each nested level using a dot (.) in the path parameter.
  If there is an array as part of the nesting, specify the index in the path.

  To include a literal `.` in the property name, prefix with a `\`. In most
  programming languages you will need to write this as `"\\."` because the
  `\` itself will need to be escaped.

  For example,
  ```typescript
  cfnResource.addOverride('Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes', ['myattribute']);
  cfnResource.addOverride('Properties.GlobalSecondaryIndexes.1.ProjectionType', 'INCLUDE');
  ```
  would add the overrides
  ```json
  "Properties": {
    "GlobalSecondaryIndexes": [
      {
        "Projection": {
          "NonKeyAttributes": [ "myattribute" ]
          ...
        }
        ...
      },
      {
        "ProjectionType": "INCLUDE"
        ...
      },
    ]
    ...
  }
  ```

  The `value` argument to `addOverride` will not be processed or translated
  in any way. Pass raw JSON values in here with the correct capitalization
  for CloudFormation. If you pass CDK classes or structs, they will be
  rendered with lowercased key names, and CloudFormation will reject the
  template.

  **Parameters**

  - `path` — - The path of the property, you can use dot notation to override values in complex types.
  - `value` — - The value.

- `addPropertyDeletionOverride(propertyPath: string): void` — Adds an override that deletes the value of a property from the resource definition.

  **Parameters**

  - `propertyPath` — The path to the property.

- `addPropertyOverride(propertyPath: string, value: any): void` — Adds an override to a resource property.

  Syntactic sugar for `addOverride("Properties.<...>", value)`.

  **Parameters**

  - `propertyPath` — The path of the property.
  - `value` — The value.

- `addResourceDependency(target: CfnResource, reason?: string): void` — Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.

  This can be used for resources across stacks (or nested stack) boundaries
  and the dependency will automatically be transferred to the relevant scope.

  This method only adds dependencies between L1 resources. If you are
  looking for a generic construct-to-construct dependency mechanism that works
  for all constructs including L2s, use `construct.node.addDependency` instead.

- `applyCrossStackReferenceStrength(strength: ReferenceStrength): void` — Sets the cross-stack reference strength for this resource.

  When set, any cross-stack reference to this resource will use the specified
  strength instead of the global default from the consuming stack's context.

  **Parameters**

  - `strength` — - The reference strength to use for this resource.

- `applyRemovalPolicy(policy?: RemovalPolicy, options?: RemovalPolicyOptions): void` — Sets the deletion policy of the resource based on the removal policy specified.

  The Removal Policy controls what happens to this resource when it stops
  being managed by CloudFormation, either because you've removed it from the
  CDK application or because you've made a change that requires the resource
  to be replaced.

  The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
  account for data recovery and cleanup later (`RemovalPolicy.RETAIN`). In some
  cases, a snapshot can be taken of the resource prior to deletion
  (`RemovalPolicy.SNAPSHOT`). A list of resources that support this policy
  can be found in the following link:

- `arnForAlarm(resource: IAlarmRef): string` (static)

- `cfnPropertyName(cdkPropertyName: string): string`

- `fromAlarmArn(scope: Construct, id: string, arn: string): IAlarmRef` (static) — Creates a new IAlarmRef from an ARN.

- `fromAlarmName(scope: Construct, id: string, alarmName: string): IAlarmRef` (static) — Creates a new IAlarmRef from a alarmName.

- `getAtt(attributeName: string, typeHint?: ResolutionTypeHint): Reference` — Returns a token for an runtime attribute of this resource.

  Ideally, use generated attribute accessors (e.g. `resource.arn`), but this can be used for future compatibility
  in case there is no generated attribute.

  **Parameters**

  - `attributeName` — The name of the attribute.

- `getMetadata(key: string): any` — Retrieve a value value from the CloudFormation Resource Metadata.

- `inspect(inspector: TreeInspector): void` — Examines the CloudFormation resource and discloses attributes.

  **Parameters**

  - `inspector` — tree inspector to collect and process attributes.

- `isCfnAlarm(x: any): boolean` (static) — Checks whether the given object is a CfnAlarm.

- `isCfnElement(x: any): boolean` (static) — Returns `true` if a construct is a stack element (i.e. part of the synthesized cloudformation template).

  Uses duck-typing instead of `instanceof` to allow stack elements from different
  versions of this library to be included in the same stack.

  **Returns:** The construct as a stack element or undefined if it is not a stack element.

- `isCfnResource(x: any): boolean` (static) — Check whether the given object is a CfnResource.

- `isConstruct(x: any): boolean` (static) — Checks if `x` is a construct.

  Use this method instead of `instanceof` to properly detect `Construct`
  instances, even when the construct library is symlinked.

  Explanation: in JavaScript, multiple copies of the `constructs` library on
  disk are seen as independent, completely different libraries. As a
  consequence, the class `Construct` in each copy of the `constructs` library
  is seen as a different class, and an instance of one class will not test as
  `instanceof` the other class. `npm install` will not create installations
  like this, but users may manually symlink construct libraries together or
  use a monorepo tool: in those cases, multiple copies of the `constructs`
  library can be accidentally installed, and `instanceof` will behave
  unpredictably. It is safest to avoid using `instanceof`, and using
  this type-testing method instead.

  **Parameters**

  - `x` — Any object.

  **Returns:** true if `x` is an object created from a class which extends `Construct`.

- `obtainDependencies(): Stack | CfnResource[]` — Retrieves an array of resources and stacks this resource depends on.

  For resources depended on directly, returns the `CfnResource` object. For
  dependencies on other stacks, returns the `Stack` object. The order of the
  array is not guaranteed.

- `overrideLogicalId(newLogicalId: string): void` — Overrides the auto-generated logical ID with a specific ID.

  **Parameters**

  - `newLogicalId` — The new logical ID to use for this stack element.

- `removeDependency(target: CfnResource): void` — Use `removeResourceDependency` instead

  This can be used for resources across stacks (including nested stacks)
  and the dependency will automatically be removed from the relevant scope.

- `removeResourceDependency(target: CfnResource): void` — Indicates that this resource no longer depends on another resource.

  This can be used for resources across stacks (including nested stacks)
  and the dependency will automatically be removed from the relevant scope.

- `replaceDependency(target: CfnResource, newTarget: CfnResource): void` — Replaces one dependency with another.

  **Parameters**

  - `target` — The dependency to replace.
  - `newTarget` — The new dependency to add.

- `toString(): string` — Returns a string representation of this construct.

  **Returns:** a string representation of this resource

- `with(...mixins: IMixin[]): IConstruct` — Applies one or more mixins to this construct.

  Mixins are applied in order. The list of constructs is captured at the
  start of the call, so constructs added by a mixin will not be visited.
  Use multiple `with()` calls if subsequent mixins should apply to added
  constructs.
