awscc_cloudwatch_alarm (Resource)

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.

Example Usage

Alarm based on an Anomaly Detector

This example creates an alarm that is based on an anomaly detector.

resource "awscc_cloudwatch_alarm" "lambda_invocations_alarm" {
  alarm_name = "LambdaInvocationsAlarm"
  comparison_operator = "LessThanLowerOrGreaterThanUpperThreshold"
  evaluation_periods = 1

  metrics = [{
    expression = "ANOMALY_DETECTION_BAND(m1, 2)"
    id = "ad1"
  },
  {
    id = "m1"
    metric_stat = {
      metric = {
        metric_name = "Invocations"
        namespace = "AWS/Lambda"
      }
      period = 86400
      stat = "Sum"
    }
  }]

  threshold_metric_id = "ad1"
  treat_missing_data = "breaching"
}

Schema

Required

Optional

Read-Only

Nested Schema for dimensions

Required:

Nested Schema for metrics

Required:

Optional:

Nested Schema for metrics.metric_stat

Required:

Optional:

Nested Schema for metrics.metric_stat.metric

Optional:

Nested Schema for metrics.metric_stat.metric.dimensions

Required:

Nested Schema for tags

Required:

Import

Import is supported using the following syntax:

$ terraform import awscc_cloudwatch_alarm.example <resource ID>