Skip to main content

anomaly_detectors

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

Overview

Nameanomaly_detectors
TypeResource
Idaws.cloudwatch.anomaly_detectors

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
anomaly_detector_idstringThe unique identifier of the anomaly detector. The identifier does not restrict access to a specific anomaly detector in an IAM policy. Permissions for anomaly detector operations apply to all anomaly detectors in the account. (pattern: <code>[A-Za-z0-9_./:%()+-]+</code>)
configurationobjectThe configuration specifies details about how the anomaly detection model is to be trained, including time ranges to exclude from use for training the model, and the time zone to use for the metric.
dimensionsarrayThe metric dimensions associated with the anomaly detection model.
metric_characteristicsobjectThis object includes parameters that you can use to provide information about your metric to CloudWatch to help it build more accurate anomaly detection models. Currently, it includes the PeriodicSpikes parameter.
metric_math_anomaly_detectorobjectThe CloudWatch metric math expression for this anomaly detector.
metric_namestringThe name of the metric associated with the anomaly detection model.
namespacestringThe namespace of the metric associated with the anomaly detection model. (pattern: <code>[^:].*</code>)
single_metric_anomaly_detectorobjectThe CloudWatch metric and statistic for this anomaly detector.
statstringThe statistic associated with the anomaly detection model. (pattern: <code>(SampleCount|Average|Sum|Minimum|Maximum|IQM|(p|tc|tm|ts|wm)(\d{1,2}(.\d{0,10})?|100)|[ou]\d+(.\d*)?)(_E|_L|_H)?|(TM|TC|TS|WM)(((((\d{1,2})(.\d{0,10})?|100(.0{0,10})?)%)?:((\d{1,2})(.\d{0,10})?|100(.0{0,10})?)%|((\d{1,2})(.\d{0,10})?|100(.0{0,10})?)%:(((\d{1,2})(.\d{0,10})?|100(.0{0,10})?)%)?))|(TM|TC|TS|WM|PR)(((\d+(.\d{0,10})?|(\d+(.\d{0,10})?[Ee][+-]?\d+)):((\d+(.\d{0,10})?|(\d+(.\d{0,10})?[Ee][+-]?\d+)))?|((\d+(.\d{0,10})?|(\d+(.\d{0,10})?[Ee][+-]?\d+)))?:(\d+(.\d{0,10})?|(\d+(.\d{0,10})?[Ee][+-]?\d+))))</code>)
state_valuestringThe current status of the anomaly detector's training. (PENDING_TRAINING, TRAINED_INSUFFICIENT_DATA, TRAINED)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_anomaly_detectorsselectregionLists the anomaly detection models that you have created in your account. For single metric anomaly detectors, you can list all of the models in your account or filter the results to only the models that are related to a certain namespace, metric name, or metric dimension. For metric math anomaly detectors, you can list them by adding METRIC_MATH to the AnomalyDetectorTypes array. This will return all metric math anomaly detectors in your account.
put_anomaly_detectorreplaceregionCreates an anomaly detection model for a CloudWatch metric. You can use the model to display a band of expected normal values when the metric is graphed. If you have enabled unified cross-account observability, and this account is a monitoring account, the metric can be in the same account or a source account. You can specify the account ID in the object you specify in the SingleMetricAnomalyDetector parameter. For more information, see CloudWatch Anomaly Detection.
delete_anomaly_detectordeleteregionDeletes the specified anomaly detection model from your account. For more information about how to delete an anomaly detection model, see Deleting an anomaly detection model in the CloudWatch User Guide.

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

Lists the anomaly detection models that you have created in your account. For single metric anomaly detectors, you can list all of the models in your account or filter the results to only the models that are related to a certain namespace, metric name, or metric dimension. For metric math anomaly detectors, you can list them by adding METRIC_MATH to the AnomalyDetectorTypes array. This will return all metric math anomaly detectors in your account.

SELECT
anomaly_detector_id,
configuration,
dimensions,
metric_characteristics,
metric_math_anomaly_detector,
metric_name,
namespace,
single_metric_anomaly_detector,
stat,
state_value
FROM aws.cloudwatch.anomaly_detectors
WHERE region = '{{ region }}' -- required
;

REPLACE examples

Creates an anomaly detection model for a CloudWatch metric. You can use the model to display a band of expected normal values when the metric is graphed. If you have enabled unified cross-account observability, and this account is a monitoring account, the metric can be in the same account or a source account. You can specify the account ID in the object you specify in the SingleMetricAnomalyDetector parameter. For more information, see CloudWatch Anomaly Detection.

REPLACE aws.cloudwatch.anomaly_detectors
SET
Namespace = '{{ Namespace }}',
MetricName = '{{ MetricName }}',
Dimensions = '{{ Dimensions }}',
Stat = '{{ Stat }}',
Configuration = '{{ Configuration }}',
MetricCharacteristics = '{{ MetricCharacteristics }}',
SingleMetricAnomalyDetector = '{{ SingleMetricAnomalyDetector }}',
MetricMathAnomalyDetector = '{{ MetricMathAnomalyDetector }}'
WHERE
region = '{{ region }}' --required
RETURNING
anomaly_detector_id;

DELETE examples

Deletes the specified anomaly detection model from your account. For more information about how to delete an anomaly detection model, see Deleting an anomaly detection model in the CloudWatch User Guide.

DELETE FROM aws.cloudwatch.anomaly_detectors
WHERE region = '{{ region }}' --required
;