Skip to main content

anomaly_detectors

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

Overview

Nameanomaly_detectors
TypeResource
Idaws.amp.anomaly_detectors

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
aliasstringThe user-friendly name of the anomaly detector. (pattern: <code>[0-9A-Za-z][-.0-9A-Z_a-z]*</code>)
anomaly_detector_idstringThe unique identifier of the anomaly detector. (pattern: <code>ad-[0-9A-Za-z][-.0-9A-Z_a-z]*</code>)
arnstringThe Amazon Resource Name (ARN) of the anomaly detector. (pattern: <code>arn:aws[-a-z]*:aps:[-a-z0-9]+:[0-9]{12}:anomalydetector/ws-.+/ad-.+</code>)
configurationobjectThe configuration for the anomaly detection algorithm.
created_atstring (date-time)The timestamp when the anomaly detector was created.
evaluation_interval_in_secondsintegerThe frequency, in seconds, at which the anomaly detector evaluates metrics.
labelsobjectThe Amazon Managed Service for Prometheus metric labels associated with the anomaly detector.
missing_data_actionobjectSpecifies the action to take when data is missing during anomaly detection evaluation.
modified_atstring (date-time)The timestamp when the anomaly detector was last modified.
statusobjectThe current status of the anomaly detector.
tagsobjectThe tags applied to the anomaly detector.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_anomaly_detectorselectworkspace_id, anomaly_detector_id, regionRetrieves detailed information about a specific anomaly detector, including its status and configuration.
list_anomaly_detectorsselectworkspace_id, regionalias, maxResults, nextTokenReturns a paginated list of anomaly detectors for a workspace with optional filtering by alias.
create_anomaly_detectorinsertworkspace_id, region, alias, configurationCreates an anomaly detector within a workspace using the Random Cut Forest algorithm for time-series analysis. The anomaly detector analyzes Amazon Managed Service for Prometheus metrics to identify unusual patterns and behaviors.
put_anomaly_detectorreplaceworkspace_id, anomaly_detector_id, region, configurationWhen you call PutAnomalyDetector, the operation creates a new anomaly detector if one doesn't exist, or updates an existing one. Each call to this operation triggers a complete retraining of the detector, which includes querying the minimum required samples and backfilling the detector with historical data. This process occurs regardless of whether you're making a minor change like updating the evaluation interval or making more substantial modifications. The operation serves as the single method for creating, updating, and retraining anomaly detectors.
delete_anomaly_detectordeleteworkspace_id, anomaly_detector_id, regionclientTokenRemoves an anomaly detector from a workspace. This operation is idempotent.

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
anomaly_detector_idstringThe identifier of the anomaly detector to delete.
regionstringAWS region (default: us-east-1)
workspace_idstringThe identifier of the workspace containing the anomaly detector to delete.
aliasstringFilters the results to anomaly detectors with the specified alias.
clientTokenstringA unique, case-sensitive identifier that you provide to ensure the idempotency of the request.
maxResultsintegerThe maximum number of results to return in a single call. Valid range is 1 to 1000.
nextTokenstringThe pagination token to continue retrieving results.

SELECT examples

Retrieves detailed information about a specific anomaly detector, including its status and configuration.

SELECT
alias,
anomaly_detector_id,
arn,
configuration,
created_at,
evaluation_interval_in_seconds,
labels,
missing_data_action,
modified_at,
status,
tags
FROM aws.amp.anomaly_detectors
WHERE workspace_id = '{{ workspace_id }}' -- required
AND anomaly_detector_id = '{{ anomaly_detector_id }}' -- required
AND region = '{{ region }}' -- required
;

INSERT examples

Creates an anomaly detector within a workspace using the Random Cut Forest algorithm for time-series analysis. The anomaly detector analyzes Amazon Managed Service for Prometheus metrics to identify unusual patterns and behaviors.

INSERT INTO aws.amp.anomaly_detectors (
alias,
evaluationIntervalInSeconds,
missingDataAction,
configuration,
labels,
clientToken,
tags,
workspace_id,
region
)
SELECT
'{{ alias }}' /* required */,
{{ evaluationIntervalInSeconds }},
'{{ missingDataAction }}',
'{{ configuration }}' /* required */,
'{{ labels }}',
'{{ clientToken }}',
'{{ tags }}',
'{{ workspace_id }}',
'{{ region }}'
RETURNING
anomaly_detector_id,
arn,
status,
tags
;

REPLACE examples

When you call PutAnomalyDetector, the operation creates a new anomaly detector if one doesn't exist, or updates an existing one. Each call to this operation triggers a complete retraining of the detector, which includes querying the minimum required samples and backfilling the detector with historical data. This process occurs regardless of whether you're making a minor change like updating the evaluation interval or making more substantial modifications. The operation serves as the single method for creating, updating, and retraining anomaly detectors.

REPLACE aws.amp.anomaly_detectors
SET
evaluationIntervalInSeconds = {{ evaluationIntervalInSeconds }},
missingDataAction = '{{ missingDataAction }}',
configuration = '{{ configuration }}',
labels = '{{ labels }}',
clientToken = '{{ clientToken }}'
WHERE
workspace_id = '{{ workspace_id }}' --required
AND anomaly_detector_id = '{{ anomaly_detector_id }}' --required
AND region = '{{ region }}' --required
AND configuration = '{{ configuration }}' --required
RETURNING
anomaly_detector_id,
arn,
status,
tags;

DELETE examples

Removes an anomaly detector from a workspace. This operation is idempotent.

DELETE FROM aws.amp.anomaly_detectors
WHERE workspace_id = '{{ workspace_id }}' --required
AND anomaly_detector_id = '{{ anomaly_detector_id }}' --required
AND region = '{{ region }}' --required
AND clientToken = '{{ clientToken }}'
;