Amazon Prometheus Service

2025/10/30 - Amazon Prometheus Service - 5 new api methods

Changes  Add Anomaly Detection APIs for Amazon Managed Prometheus

PutAnomalyDetector (new) Link ¶

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.

See also: AWS API Documentation

Request Syntax

client.put_anomaly_detector(
    workspaceId='string',
    anomalyDetectorId='string',
    evaluationIntervalInSeconds=123,
    missingDataAction={
        'markAsAnomaly': True|False,
        'skip': True|False
    },
    configuration={
        'randomCutForest': {
            'query': 'string',
            'shingleSize': 123,
            'sampleSize': 123,
            'ignoreNearExpectedFromAbove': {
                'amount': 123.0,
                'ratio': 123.0
            },
            'ignoreNearExpectedFromBelow': {
                'amount': 123.0,
                'ratio': 123.0
            }
        }
    },
    labels={
        'string': 'string'
    },
    clientToken='string'
)
type workspaceId:

string

param workspaceId:

[REQUIRED]

The identifier of the workspace containing the anomaly detector to update.

type anomalyDetectorId:

string

param anomalyDetectorId:

[REQUIRED]

The identifier of the anomaly detector to update.

type evaluationIntervalInSeconds:

integer

param evaluationIntervalInSeconds:

The frequency, in seconds, at which the anomaly detector evaluates metrics.

type missingDataAction:

dict

param missingDataAction:

Specifies the action to take when data is missing during evaluation.

  • markAsAnomaly (boolean) --

    Marks missing data points as anomalies.

  • skip (boolean) --

    Skips evaluation when data is missing.

type configuration:

dict

param configuration:

[REQUIRED]

The algorithm configuration for the anomaly detector.

  • randomCutForest (dict) --

    The Random Cut Forest algorithm configuration for anomaly detection.

    • query (string) -- [REQUIRED]

      The Prometheus query used to retrieve the time-series data for anomaly detection.

    • shingleSize (integer) --

      The number of consecutive data points used to create a shingle for the Random Cut Forest algorithm. The default number is 8 consecutive data points.

    • sampleSize (integer) --

      The number of data points sampled from the input stream for the Random Cut Forest algorithm. The default number is 256 consecutive data points.

    • ignoreNearExpectedFromAbove (dict) --

      Configuration for ignoring values that are near expected values from above during anomaly detection.

      • amount (float) --

        The absolute amount by which values can differ from expected values before being considered anomalous.

      • ratio (float) --

        The ratio by which values can differ from expected values before being considered anomalous.

    • ignoreNearExpectedFromBelow (dict) --

      Configuration for ignoring values that are near expected values from below during anomaly detection.

      • amount (float) --

        The absolute amount by which values can differ from expected values before being considered anomalous.

      • ratio (float) --

        The ratio by which values can differ from expected values before being considered anomalous.

type labels:

dict

param labels:

The Amazon Managed Service for Prometheus metric labels to associate with the anomaly detector.

  • (string) --

    • (string) --

type clientToken:

string

param clientToken:

A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

This field is autopopulated if not provided.

rtype:

dict

returns:

Response Syntax

{
    'anomalyDetectorId': 'string',
    'arn': 'string',
    'status': {
        'statusCode': 'CREATING'|'ACTIVE'|'UPDATING'|'DELETING'|'CREATION_FAILED'|'UPDATE_FAILED'|'DELETION_FAILED',
        'statusReason': 'string'
    },
    'tags': {
        'string': 'string'
    }
}

Response Structure

  • (dict) --

    • anomalyDetectorId (string) --

      The unique identifier of the updated anomaly detector.

    • arn (string) --

      The Amazon Resource Name (ARN) of the updated anomaly detector.

    • status (dict) --

      The status information of the updated anomaly detector.

      • statusCode (string) --

        The status code of the anomaly detector.

      • statusReason (string) --

        A description of the current status of the anomaly detector.

    • tags (dict) --

      The tags applied to the updated anomaly detector.

      • (string) --

        The key of the tag. Must not begin with aws:.

        • (string) --

          The value of the tag.

DeleteAnomalyDetector (new) Link ¶

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

See also: AWS API Documentation

Request Syntax

client.delete_anomaly_detector(
    workspaceId='string',
    anomalyDetectorId='string',
    clientToken='string'
)
type workspaceId:

string

param workspaceId:

[REQUIRED]

The identifier of the workspace containing the anomaly detector to delete.

type anomalyDetectorId:

string

param anomalyDetectorId:

[REQUIRED]

The identifier of the anomaly detector to delete.

type clientToken:

string

param clientToken:

A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

This field is autopopulated if not provided.

returns:

None

DescribeAnomalyDetector (new) Link ¶

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

See also: AWS API Documentation

Request Syntax

client.describe_anomaly_detector(
    workspaceId='string',
    anomalyDetectorId='string'
)
type workspaceId:

string

param workspaceId:

[REQUIRED]

The identifier of the workspace containing the anomaly detector.

type anomalyDetectorId:

string

param anomalyDetectorId:

[REQUIRED]

The identifier of the anomaly detector to describe.

rtype:

dict

returns:

Response Syntax

{
    'anomalyDetector': {
        'arn': 'string',
        'anomalyDetectorId': 'string',
        'alias': 'string',
        'evaluationIntervalInSeconds': 123,
        'missingDataAction': {
            'markAsAnomaly': True|False,
            'skip': True|False
        },
        'configuration': {
            'randomCutForest': {
                'query': 'string',
                'shingleSize': 123,
                'sampleSize': 123,
                'ignoreNearExpectedFromAbove': {
                    'amount': 123.0,
                    'ratio': 123.0
                },
                'ignoreNearExpectedFromBelow': {
                    'amount': 123.0,
                    'ratio': 123.0
                }
            }
        },
        'labels': {
            'string': 'string'
        },
        'status': {
            'statusCode': 'CREATING'|'ACTIVE'|'UPDATING'|'DELETING'|'CREATION_FAILED'|'UPDATE_FAILED'|'DELETION_FAILED',
            'statusReason': 'string'
        },
        'createdAt': datetime(2015, 1, 1),
        'modifiedAt': datetime(2015, 1, 1),
        'tags': {
            'string': 'string'
        }
    }
}

Response Structure

  • (dict) --

    • anomalyDetector (dict) --

      The detailed information about the anomaly detector.

      • arn (string) --

        The Amazon Resource Name (ARN) of the anomaly detector.

      • anomalyDetectorId (string) --

        The unique identifier of the anomaly detector.

      • alias (string) --

        The user-friendly name of the anomaly detector.

      • evaluationIntervalInSeconds (integer) --

        The frequency, in seconds, at which the anomaly detector evaluates metrics.

      • missingDataAction (dict) --

        The action taken when data is missing during evaluation.

        • markAsAnomaly (boolean) --

          Marks missing data points as anomalies.

        • skip (boolean) --

          Skips evaluation when data is missing.

      • configuration (dict) --

        The algorithm configuration of the anomaly detector.

        • randomCutForest (dict) --

          The Random Cut Forest algorithm configuration for anomaly detection.

          • query (string) --

            The Prometheus query used to retrieve the time-series data for anomaly detection.

          • shingleSize (integer) --

            The number of consecutive data points used to create a shingle for the Random Cut Forest algorithm. The default number is 8 consecutive data points.

          • sampleSize (integer) --

            The number of data points sampled from the input stream for the Random Cut Forest algorithm. The default number is 256 consecutive data points.

          • ignoreNearExpectedFromAbove (dict) --

            Configuration for ignoring values that are near expected values from above during anomaly detection.

            • amount (float) --

              The absolute amount by which values can differ from expected values before being considered anomalous.

            • ratio (float) --

              The ratio by which values can differ from expected values before being considered anomalous.

          • ignoreNearExpectedFromBelow (dict) --

            Configuration for ignoring values that are near expected values from below during anomaly detection.

            • amount (float) --

              The absolute amount by which values can differ from expected values before being considered anomalous.

            • ratio (float) --

              The ratio by which values can differ from expected values before being considered anomalous.

      • labels (dict) --

        The Amazon Managed Service for Prometheus metric labels associated with the anomaly detector.

        • (string) --

          • (string) --

      • status (dict) --

        The current status of the anomaly detector.

        • statusCode (string) --

          The status code of the anomaly detector.

        • statusReason (string) --

          A description of the current status of the anomaly detector.

      • createdAt (datetime) --

        The timestamp when the anomaly detector was created.

      • modifiedAt (datetime) --

        The timestamp when the anomaly detector was last modified.

      • tags (dict) --

        The tags applied to the anomaly detector.

        • (string) --

          The key of the tag. Must not begin with aws:.

          • (string) --

            The value of the tag.

CreateAnomalyDetector (new) Link ¶

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.

See also: AWS API Documentation

Request Syntax

client.create_anomaly_detector(
    workspaceId='string',
    alias='string',
    evaluationIntervalInSeconds=123,
    missingDataAction={
        'markAsAnomaly': True|False,
        'skip': True|False
    },
    configuration={
        'randomCutForest': {
            'query': 'string',
            'shingleSize': 123,
            'sampleSize': 123,
            'ignoreNearExpectedFromAbove': {
                'amount': 123.0,
                'ratio': 123.0
            },
            'ignoreNearExpectedFromBelow': {
                'amount': 123.0,
                'ratio': 123.0
            }
        }
    },
    labels={
        'string': 'string'
    },
    clientToken='string',
    tags={
        'string': 'string'
    }
)
type workspaceId:

string

param workspaceId:

[REQUIRED]

The identifier of the workspace where the anomaly detector will be created.

type alias:

string

param alias:

[REQUIRED]

A user-friendly name for the anomaly detector.

type evaluationIntervalInSeconds:

integer

param evaluationIntervalInSeconds:

The frequency, in seconds, at which the anomaly detector evaluates metrics. The default value is 60 seconds.

type missingDataAction:

dict

param missingDataAction:

Specifies the action to take when data is missing during evaluation.

  • markAsAnomaly (boolean) --

    Marks missing data points as anomalies.

  • skip (boolean) --

    Skips evaluation when data is missing.

type configuration:

dict

param configuration:

[REQUIRED]

The algorithm configuration for the anomaly detector.

  • randomCutForest (dict) --

    The Random Cut Forest algorithm configuration for anomaly detection.

    • query (string) -- [REQUIRED]

      The Prometheus query used to retrieve the time-series data for anomaly detection.

    • shingleSize (integer) --

      The number of consecutive data points used to create a shingle for the Random Cut Forest algorithm. The default number is 8 consecutive data points.

    • sampleSize (integer) --

      The number of data points sampled from the input stream for the Random Cut Forest algorithm. The default number is 256 consecutive data points.

    • ignoreNearExpectedFromAbove (dict) --

      Configuration for ignoring values that are near expected values from above during anomaly detection.

      • amount (float) --

        The absolute amount by which values can differ from expected values before being considered anomalous.

      • ratio (float) --

        The ratio by which values can differ from expected values before being considered anomalous.

    • ignoreNearExpectedFromBelow (dict) --

      Configuration for ignoring values that are near expected values from below during anomaly detection.

      • amount (float) --

        The absolute amount by which values can differ from expected values before being considered anomalous.

      • ratio (float) --

        The ratio by which values can differ from expected values before being considered anomalous.

type labels:

dict

param labels:

The Amazon Managed Service for Prometheus metric labels to associate with the anomaly detector.

  • (string) --

    • (string) --

type clientToken:

string

param clientToken:

A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

This field is autopopulated if not provided.

type tags:

dict

param tags:

The metadata to apply to the anomaly detector to assist with categorization and organization.

  • (string) --

    The key of the tag. Must not begin with aws:.

    • (string) --

      The value of the tag.

rtype:

dict

returns:

Response Syntax

{
    'anomalyDetectorId': 'string',
    'arn': 'string',
    'status': {
        'statusCode': 'CREATING'|'ACTIVE'|'UPDATING'|'DELETING'|'CREATION_FAILED'|'UPDATE_FAILED'|'DELETION_FAILED',
        'statusReason': 'string'
    },
    'tags': {
        'string': 'string'
    }
}

Response Structure

  • (dict) --

    • anomalyDetectorId (string) --

      The unique identifier of the created anomaly detector.

    • arn (string) --

      The Amazon Resource Name (ARN) of the created anomaly detector.

    • status (dict) --

      The status information of the created anomaly detector.

      • statusCode (string) --

        The status code of the anomaly detector.

      • statusReason (string) --

        A description of the current status of the anomaly detector.

    • tags (dict) --

      The tags applied to the created anomaly detector.

      • (string) --

        The key of the tag. Must not begin with aws:.

        • (string) --

          The value of the tag.

ListAnomalyDetectors (new) Link ¶

Returns a paginated list of anomaly detectors for a workspace with optional filtering by alias.

See also: AWS API Documentation

Request Syntax

client.list_anomaly_detectors(
    workspaceId='string',
    alias='string',
    maxResults=123,
    nextToken='string'
)
type workspaceId:

string

param workspaceId:

[REQUIRED]

The identifier of the workspace containing the anomaly detectors to list.

type alias:

string

param alias:

Filters the results to anomaly detectors with the specified alias.

type maxResults:

integer

param maxResults:

The maximum number of results to return in a single call. Valid range is 1 to 1000.

type nextToken:

string

param nextToken:

The pagination token to continue retrieving results.

rtype:

dict

returns:

Response Syntax

{
    'anomalyDetectors': [
        {
            'arn': 'string',
            'anomalyDetectorId': 'string',
            'alias': 'string',
            'status': {
                'statusCode': 'CREATING'|'ACTIVE'|'UPDATING'|'DELETING'|'CREATION_FAILED'|'UPDATE_FAILED'|'DELETION_FAILED',
                'statusReason': 'string'
            },
            'createdAt': datetime(2015, 1, 1),
            'modifiedAt': datetime(2015, 1, 1),
            'tags': {
                'string': 'string'
            }
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • anomalyDetectors (list) --

      The list of anomaly detectors in the workspace.

      • (dict) --

        Summary information about an anomaly detector for list operations.

        • arn (string) --

          The Amazon Resource Name (ARN) of the anomaly detector.

        • anomalyDetectorId (string) --

          The unique identifier of the anomaly detector.

        • alias (string) --

          The user-friendly name of the anomaly detector.

        • status (dict) --

          The current status of the anomaly detector.

          • statusCode (string) --

            The status code of the anomaly detector.

          • statusReason (string) --

            A description of the current status of the anomaly detector.

        • createdAt (datetime) --

          The timestamp when the anomaly detector was created.

        • modifiedAt (datetime) --

          The timestamp when the anomaly detector was last modified.

        • tags (dict) --

          The tags applied to the anomaly detector.

          • (string) --

            The key of the tag. Must not begin with aws:.

            • (string) --

              The value of the tag.

    • nextToken (string) --

      The pagination token to retrieve the next set of results.