Skip to main content
Version: 0.0.25

Table: metric_alarm

Table to query for all AWS Cloudwatch metric alarms in the system. You can use Amazon CloudWatch Logs to monitor,store, and access your log files from Amazon Elastic Compute Cloud (Amazon EC2) instances, AWS CloudTrail, Route 53, and other sources.

A metric alarm watches a single CloudWatch metric or the result of a math expression based on CloudWatch metrics. The alarm performs one or more actions based on the value of the metric or expression relative to a threshold over a number of time periods. The action can be sending a notification to an Amazon SNS topic, performing an Amazon EC2 action or an Amazon EC2 Auto Scaling action, or creating an OpsItem or incident in Systems Manager.


 INSERT INTO metric_alarm (alarm_name, alarm_description, actions_enabled, comparison_operator, datapoints_to_alarm, dimensions, metric_name, namespace, period, statistic, threshold, evaluation_periods)
VALUES ('alarm_name', 'Metric alarm description', true, 'GreaterThanThreshold', 1, '[{"Name": "InstanceId", "Value": "test"}]', 'CPUUtilization', 'AWS/EC2', 60, 'Average', 10, 1);

SELECT * FROM metric_alarm where alarm_name='alarm_name';

DELETE FROM metric_alarm wheer alarm_name='alarm_name';



Optional actions_enabled: boolean

Indicates whether actions should be executed during any changes to the alarm state

Optional alarm_actions: string[]

The actions to execute when this alarm transitions to the ALARM state from any other state. Each action is specified as an Amazon Resource Name (ARN).

alarm_arn: string

The Amazon Resource Name (ARN) of the alarm.

Optional alarm_description: string

The description for the alarm

alarm_name: string

Alarm name

Optional comparison_operator: comparison_operator

The arithmetic operation to use when comparing the specified statistic and threshold. The specified statistic value is used as the first operand.

Optional datapoints_to_alarm: number

The number of data points that must be breaching to trigger the alarm.


dimensions: { name: undefined | string ; value: undefined | string }[]

The dimensions for the metric specified in MetricName


Optional evaluate_low_sample_count_percentile: evaluate_low_sample_count_percentile

Used only for alarms based on percentiles


Optional evaluation_periods: number

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


Optional extended_statistic: string

The percentile statistic for the metric specified in MetricName.


Optional insufficient_data_actions: string[]

The actions to execute when this alarm transitions to the INSUFFICIENT_DATA state from any other state.


Optional metric_name: string

The name for the metric associated with the alarm.

metrics: { account_id?: string ; expression?: string ; id: undefined | string ; label?: string ; metric_stat?: { metric: undefined | { dimensions?: { name: undefined | string ; value: undefined | string }[] ; metric_name?: string ; namespace?: string } ; period: undefined | number ; stat: undefined | string ; unit?: string } ; period?: number ; return_data?: boolean }[]

An array of MetricDataQuery structures that enable you to create an alarm based on the result of a metric math expression.


Optional namespace: string

The namespace for the metric associated specified in MetricName.

Optional ok_actions: string[]

The actions to execute when this alarm transitions to an OK state from any other state.

Optional period: number

The length, in seconds, used each time the metric specified in MetricName is evaluated.


region: string

Region for the alarm

Optional statistic: statistic

The statistic for the metric specified in MetricName, other than percentile.


Optional threshold: number

The value against which the specified statistic is compared.

Optional threshold_metric_id: string

If this is an alarm based on an anomaly detection model, make this value match the ID of the ANOMALY_DETECTION_BAND function.

Optional treat_missing_data: treat_missing_data

Sets how this alarm is to handle missing data points.


Optional unit: standard_unit

The unit of measure for the statistic.