alarms
Creates, updates, deletes, gets or lists an alarms resource.
Overview
| Name | alarms |
| Type | Resource |
| Id | aws.lightsail.alarms |
Fields
The following fields are returned by SELECT queries:
- get_alarms
| Name | Datatype | Description |
|---|---|---|
alarms | array | An array of objects that describe the alarms. |
next_page_token | string | The 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:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_alarms | select | region | 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. | |
put_alarm | replace | region, alarmName, metricName, monitoredResourceName, comparisonOperator, threshold, evaluationPeriods | 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. | |
delete_alarm | delete | region | 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. | |
test_alarm | exec | region, alarmName, state | 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. |
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.
| Name | Datatype | Description |
|---|---|---|
region | string | AWS region (default: us-east-1) |
SELECT examples
- get_alarms
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
- put_alarm
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
- delete_alarm
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
- test_alarm
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 }}"
}'
;