The following arguments are supported:
- alarm_name - (Required) The descriptive name for the alarm. This name must be unique within the user's AWS account
- comparison_operator - (Required) The arithmetic operation to use when comparing the specified Statistic and Threshold. The specified Statistic value is used as the first operand. Either of the following is supported: GreaterThanOrEqualToThreshold, GreaterThanThreshold, LessThanThreshold, LessThanOrEqualToThreshold. Additionally, the values LessThanLowerOrGreaterThanUpperThreshold, LessThanLowerThreshold, and GreaterThanUpperThreshold are used only for alarms based on anomaly detection models.
- evaluation_periods - (Required) The number of periods over which data is compared to the specified threshold.
- metric_name - (Optional) The name for the alarm's associated metric. See docs for supported metrics.
- namespace - (Optional) The namespace for the alarm's associated metric. See docs for the list of namespaces. See docs for supported metrics.
- period - (Optional) The period in seconds over which the specified statistic is applied.
- statistic - (Optional) The statistic to apply to the alarm's associated metric. Either of the following is supported: SampleCount, Average, Sum, Minimum, Maximum
- threshold - (Optional) The value against which the specified statistic is compared. This parameter is required for alarms based on static thresholds, but should not be used for alarms based on anomaly detection models.
- threshold_metric_id - (Optional) If this is an alarm based on an anomaly detection model, make this value match the ID of the ANOMALY_DETECTION_BAND function.
- actions_enabled - (Optional) Indicates whether or not actions should be executed during any changes to the alarm's state. Defaults to true.
- alarm_actions - (Optional) The list of actions to execute when this alarm transitions into an ALARM state from any other state. Each action is specified as an Amazon Resource Name (ARN).
- alarm_description - (Optional) The description for the alarm.
- datapoints_to_alarm - (Optional) The number of datapoints that must be breaching to trigger the alarm.
- dimensions - (Optional) The dimensions for the alarm's associated metric. For the list of available dimensions see the AWS documentation here.
- insufficient_data_actions - (Optional) The list of actions to execute when this alarm transitions into an INSUFFICIENT_DATA state from any other state. Each action is specified as an Amazon Resource Name (ARN).
- ok_actions - (Optional) The list of actions to execute when this alarm transitions into an OK state from any other state. Each action is specified as an Amazon Resource Name (ARN).
- unit - (Optional) The unit for the alarm's associated metric.
- extended_statistic - (Optional) The percentile statistic for the metric associated with the alarm. Specify a value between p0.0 and p100.
- treat_missing_data - (Optional) Sets how this alarm is to handle missing data points. The following values are supported: missing, ignore, breaching and notBreaching. Defaults to missing.
- evaluate_low_sample_count_percentiles - (Optional) Used only for alarms based on percentiles. If you specify ignore, the alarm state will not change during periods with too few data points to be statistically significant. If you specify evaluate or omit this parameter, the alarm will always be evaluated and possibly change state no matter how many data points are available. The following values are supported: ignore, and evaluate.
- metric_query (Optional) Enables you to create an alarm based on a metric math expression. You may specify at most 20.
- tags - (Optional) A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
NOTE:
If you specify at least one metric_query, you may not specify a metric_name, namespace, period or statistic. If you do not specify a metric_query, you must specify each of these (although you may use extended_statistic instead of statistic).
Nested fields
metric_query
- id - (Required) A short name used to tie this object to the results in the response. If you are performing math expressions on this set of data, this name represents that data and can serve as a variable in the mathematical expression. The valid characters are letters, numbers, and underscore. The first character must be a lowercase letter.
- account_id - (Optional) The ID of the account where the metrics are located, if this is a cross-account alarm.
- expression - (Optional) The math expression to be performed on the returned data, if this object is performing a math expression. This expression can use the id of the other metrics to refer to those metrics, and can also use the id of other expressions to use the result of those expressions. For more information about metric math expressions, see Metric Math Syntax and Functions in the Amazon CloudWatch User Guide.
- label - (Optional) A human-readable label for this metric or expression. This is especially useful if this is an expression, so that you know what the value represents.
- return_data (Optional) Specify exactly one metric_query to be true to use that metric_query result as the alarm.
- metric (Optional) The metric to be returned, along with statistics, period, and units. Use this parameter only if this object is retrieving a metric and not performing a math expression on returned data.
NOTE:
You must specify either metric or expression. Not both.
metric
- dimensions - (Optional) The dimensions for this metric. For the list of available dimensions see the AWS documentation here.
- metric_name - (Required) The name for this metric. See docs for supported metrics.
- namespace - (Required) The namespace for this metric. See docs for the list of namespaces. See docs for supported metrics.
- period - (Required) The period in seconds over which the specified stat is applied.
- stat - (Required) The statistic to apply to this metric. See docs for supported statistics.
- unit - (Optional) The unit for this metric.