anomaly_detectors
Creates, updates, deletes, gets or lists an anomaly_detectors resource.
Overview
| Name | anomaly_detectors |
| Type | Resource |
| Id | aws.cloudwatch.anomaly_detectors |
Fields
The following fields are returned by SELECT queries:
- describe_anomaly_detectors
| Name | Datatype | Description |
|---|---|---|
anomaly_detector_id | string | The 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>) |
configuration | object | The 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. |
dimensions | array | The metric dimensions associated with the anomaly detection model. |
metric_characteristics | object | This 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_detector | object | The CloudWatch metric math expression for this anomaly detector. |
metric_name | string | The name of the metric associated with the anomaly detection model. |
namespace | string | The namespace of the metric associated with the anomaly detection model. (pattern: <code>[^:].*</code>) |
single_metric_anomaly_detector | object | The CloudWatch metric and statistic for this anomaly detector. |
stat | string | The 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_value | string | The current status of the anomaly detector's training. (PENDING_TRAINING, TRAINED_INSUFFICIENT_DATA, TRAINED) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
describe_anomaly_detectors | select | region | 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. | |
put_anomaly_detector | replace | region | 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. | |
delete_anomaly_detector | delete | region | 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. |
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
- describe_anomaly_detectors
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
- put_anomaly_detector
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
- delete_anomaly_detector
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
;