AWS Fundamentals Logo
AWS Fundamentals
L1 ConstructAWS::Lightsail::Alarm

CfnAlarm

The `AWS::Lightsail::Alarm` resource specifies an alarm that can be used to monitor a single metric for one of your Lightsail resources.

Import

import { CfnAlarm } from 'aws-cdk-lib/aws-lightsail';

Or use the module namespace:

import * as lightsail from 'aws-cdk-lib/aws-lightsail';
// lightsail.CfnAlarm

Properties

Configuration passed to the constructor as CfnAlarmProps.

alarmNameRequired
string

The name of the alarm.

comparisonOperatorRequired
string

The arithmetic operation to use when comparing the specified statistic and threshold.

evaluationPeriodsRequired
number

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

metricNameRequired
string

The name of the metric associated with the alarm.

monitoredResourceNameRequired
string

The name of the Lightsail resource that the alarm monitors.

thresholdRequired
number

The value against which the specified statistic is compared.

contactProtocolsOptional
string[]

The contact protocols for the alarm, such as `Email` , `SMS` (text messaging), or both. *Allowed Values* : `Email` | `SMS`

datapointsToAlarmOptional
number

The number of data points within the evaluation periods that must be breaching to cause the alarm to go to the `ALARM` state.

notificationEnabledOptional
boolean | IResolvable

A Boolean value indicating whether the alarm is enabled.

notificationTriggersOptional
string[]

The alarm states that trigger a notification. > To specify the `OK` and `INSUFFICIENT_DATA` values, you must also specify `ContactProtocols` values. Otherwise, the `OK` and `INSUFFICIENT_DATA` values will not take effect and the stack will drift. *Allowed Values* : `OK` | `ALARM` | `INSUFFICIENT_DATA`

treatMissingDataOptional
string

Specifies how the alarm handles missing data points. An alarm can treat missing data in the following ways: - `breaching` - Assumes the missing data is not within the threshold. Missing data counts towards the number of times that the metric is not within the threshold. - `notBreaching` - Assumes the missing data is within the threshold. Missing data does not count towards the number of times that the metric is not within the threshold. - `ignore` - Ignores the missing data. Maintains the current alarm state. - `missing` - Missing data is treated as missing.

CloudFormation Resource

This L1 construct maps directly to the following CloudFormation resource type.

Learn AWS the Practical Way

Our bi-weekly newsletter teaches hands-on AWS fundamentals. No certification fluff - just practical knowledge.

Subscribe to Newsletter