Skip to main content

alarms

Creates, updates, deletes, gets or lists an alarms resource.

Overview

Namealarms
TypeResource
Idaws.lightsail.alarms

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
alarmsarrayAn array of objects that describe the alarms.
next_page_tokenstringThe token to advance to the next page of results from your request. A next page token is not returned if there are no more results to display. To get the next page of results, perform another GetAlarms request and specify the next page token using the pageToken parameter.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_alarmsselectregionReturns information about the configured alarms. Specify an alarm name in your request to return information about a specific alarm, or specify a monitored resource name to return information about all alarms for a specific resource. An alarm is used to monitor a single metric for one of your resources. When a metric condition is met, the alarm can notify you by email, SMS text message, and a banner displayed on the Amazon Lightsail console. For more information, see Alarms in Amazon Lightsail.
put_alarmreplaceregion, alarmName, metricName, monitoredResourceName, comparisonOperator, threshold, evaluationPeriodsCreates or updates an alarm, and associates it with the specified metric. An alarm is used to monitor a single metric for one of your resources. When a metric condition is met, the alarm can notify you by email, SMS text message, and a banner displayed on the Amazon Lightsail console. For more information, see Alarms in Amazon Lightsail. When this action 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. The alarm is then evaluated with the updated configuration. The put alarm operation supports tag-based access control via request tags. For more information, see the Lightsail Developer Guide.
delete_alarmdeleteregionDeletes an alarm. An alarm is used to monitor a single metric for one of your resources. When a metric condition is met, the alarm can notify you by email, SMS text message, and a banner displayed on the Amazon Lightsail console. For more information, see Alarms in Amazon Lightsail.
test_alarmexecregion, alarmName, stateTests an alarm by displaying a banner on the Amazon Lightsail console. If a notification trigger is configured for the specified alarm, the test also sends a notification to the notification protocol (Email and/or SMS) configured for the alarm. An alarm is used to monitor a single metric for one of your resources. When a metric condition is met, the alarm can notify you by email, SMS text message, and a banner displayed on the Amazon Lightsail console. For more information, see Alarms in Amazon Lightsail.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

Returns information about the configured alarms. Specify an alarm name in your request to return information about a specific alarm, or specify a monitored resource name to return information about all alarms for a specific resource. An alarm is used to monitor a single metric for one of your resources. When a metric condition is met, the alarm can notify you by email, SMS text message, and a banner displayed on the Amazon Lightsail console. For more information, see Alarms in Amazon Lightsail.

SELECT
alarms,
next_page_token
FROM aws.lightsail.alarms
WHERE region = '{{ region }}' -- required
;

REPLACE examples

Creates or updates an alarm, and associates it with the specified metric. An alarm is used to monitor a single metric for one of your resources. When a metric condition is met, the alarm can notify you by email, SMS text message, and a banner displayed on the Amazon Lightsail console. For more information, see Alarms in Amazon Lightsail. When this action 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. The alarm is then evaluated with the updated configuration. The put alarm operation supports tag-based access control via request tags. For more information, see the Lightsail Developer Guide.

REPLACE aws.lightsail.alarms
SET
alarmName = '{{ alarmName }}',
metricName = '{{ metricName }}',
monitoredResourceName = '{{ monitoredResourceName }}',
comparisonOperator = '{{ comparisonOperator }}',
threshold = {{ threshold }},
evaluationPeriods = {{ evaluationPeriods }},
datapointsToAlarm = {{ datapointsToAlarm }},
treatMissingData = '{{ treatMissingData }}',
contactProtocols = '{{ contactProtocols }}',
notificationTriggers = '{{ notificationTriggers }}',
notificationEnabled = {{ notificationEnabled }},
tags = '{{ tags }}'
WHERE
region = '{{ region }}' --required
AND alarmName = '{{ alarmName }}' --required
AND metricName = '{{ metricName }}' --required
AND monitoredResourceName = '{{ monitoredResourceName }}' --required
AND comparisonOperator = '{{ comparisonOperator }}' --required
AND threshold = '{{ threshold }}' --required
AND evaluationPeriods = '{{ evaluationPeriods }}' --required
RETURNING
operations;

DELETE examples

Deletes an alarm. An alarm is used to monitor a single metric for one of your resources. When a metric condition is met, the alarm can notify you by email, SMS text message, and a banner displayed on the Amazon Lightsail console. For more information, see Alarms in Amazon Lightsail.

DELETE FROM aws.lightsail.alarms
WHERE region = '{{ region }}' --required
;

Lifecycle Methods

Tests an alarm by displaying a banner on the Amazon Lightsail console. If a notification trigger is configured for the specified alarm, the test also sends a notification to the notification protocol (Email and/or SMS) configured for the alarm. An alarm is used to monitor a single metric for one of your resources. When a metric condition is met, the alarm can notify you by email, SMS text message, and a banner displayed on the Amazon Lightsail console. For more information, see Alarms in Amazon Lightsail.

EXEC aws.lightsail.alarms.test_alarm
@region='{{ region }}' --required
@@json=
'{
"alarmName": "{{ alarmName }}",
"state": "{{ state }}"
}'
;