Skip to main content

alarms

Creates, updates, deletes or gets an alarm resource or lists alarms in a region

Overview

Namealarms
TypeResource
DescriptionResource Type definition for AWS::Lightsail::Alarm
Idawscc.lightsail.alarms

Fields

NameDatatypeDescription
alarm_namestringThe name for the alarm. Specify the name of an existing alarm to update, and overwrite the previous configuration of the alarm.
monitored_resource_namestringThe name of the Lightsail resource that the alarm monitors.
metric_namestringThe name of the metric to associate with the alarm.
comparison_operatorstringThe arithmetic operation to use when comparing the specified statistic to the threshold. The specified statistic value is used as the first operand.
contact_protocolsarrayThe contact protocols to use for the alarm, such as Email, SMS (text messaging), or both.
alarm_arnstring
datapoints_to_alarmintegerThe number of data points that must be not within the specified threshold to trigger the alarm. If you are setting an "M out of N" alarm, this value (datapointsToAlarm) is the M.
evaluation_periodsintegerThe number of most recent periods over which data is compared to the specified threshold. If you are setting an "M out of N" alarm, this value (evaluationPeriods) is the N.
notification_enabledbooleanIndicates whether the alarm is enabled. Notifications are enabled by default if you don't specify this parameter.
notification_triggersarrayThe alarm states that trigger a notification.
thresholdnumberThe value against which the specified statistic is compared.
treat_missing_datastringSets how this alarm will handle missing data points.
statestringThe current state of the alarm.
regionstringAWS region.

For more information, see AWS::Lightsail::Alarm.

Methods

NameResourceAccessible byRequired Params
create_resourcealarmsINSERTAlarmName, MonitoredResourceName, MetricName, ComparisonOperator, EvaluationPeriods, Threshold, region
delete_resourcealarmsDELETEIdentifier, region
update_resourcealarmsUPDATEIdentifier, PatchDocument, region
list_resourcesalarms_list_onlySELECTregion
get_resourcealarmsSELECTIdentifier, region

SELECT examples

Gets all properties from an individual alarm.

SELECT
region,
alarm_name,
monitored_resource_name,
metric_name,
comparison_operator,
contact_protocols,
alarm_arn,
datapoints_to_alarm,
evaluation_periods,
notification_enabled,
notification_triggers,
threshold,
treat_missing_data,
state
FROM awscc.lightsail.alarms
WHERE
region = 'us-east-1' AND
Identifier = '{{ alarm_name }}';

INSERT example

Use the following StackQL query and manifest file to create a new alarm resource, using stack-deploy.

/*+ create */
INSERT INTO awscc.lightsail.alarms (
AlarmName,
MonitoredResourceName,
MetricName,
ComparisonOperator,
EvaluationPeriods,
Threshold,
region
)
SELECT
'{{ alarm_name }}',
'{{ monitored_resource_name }}',
'{{ metric_name }}',
'{{ comparison_operator }}',
'{{ evaluation_periods }}',
'{{ threshold }}',
'{{ region }}';

UPDATE example

Use the following StackQL query and manifest file to update a alarm resource, using stack-deploy.

/*+ update */
UPDATE awscc.lightsail.alarms
SET PatchDocument = string('{{ {
"ComparisonOperator": comparison_operator,
"ContactProtocols": contact_protocols,
"DatapointsToAlarm": datapoints_to_alarm,
"EvaluationPeriods": evaluation_periods,
"NotificationEnabled": notification_enabled,
"NotificationTriggers": notification_triggers,
"Threshold": threshold,
"TreatMissingData": treat_missing_data
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ alarm_name }}';

DELETE example

/*+ delete */
DELETE FROM awscc.lightsail.alarms
WHERE
Identifier = '{{ alarm_name }}' AND
region = 'us-east-1';

Permissions

To operate on the alarms resource, the following permissions are required:

lightsail:PutAlarm,
lightsail:GetAlarms