AWS Cost Explorer Service

2024/11/22 - AWS Cost Explorer Service - 1 updated api methods

Changes  This release adds the Impact field(contains Contribution field) to the GetAnomalies API response under RootCause

GetAnomalies (updated) Link ΒΆ
Changes (response)
{'Anomalies': {'RootCauses': {'Impact': {'Contribution': 'double'}}}}

Retrieves all of the cost anomalies detected on your account during the time period that's specified by the DateInterval object. Anomalies are available for up to 90 days.

See also: AWS API Documentation

Request Syntax

client.get_anomalies(
    MonitorArn='string',
    DateInterval={
        'StartDate': 'string',
        'EndDate': 'string'
    },
    Feedback='YES'|'NO'|'PLANNED_ACTIVITY',
    TotalImpact={
        'NumericOperator': 'EQUAL'|'GREATER_THAN_OR_EQUAL'|'LESS_THAN_OR_EQUAL'|'GREATER_THAN'|'LESS_THAN'|'BETWEEN',
        'StartValue': 123.0,
        'EndValue': 123.0
    },
    NextPageToken='string',
    MaxResults=123
)
type MonitorArn:

string

param MonitorArn:

Retrieves all of the cost anomalies detected for a specific cost anomaly monitor Amazon Resource Name (ARN).

type DateInterval:

dict

param DateInterval:

[REQUIRED]

Assigns the start and end dates for retrieving cost anomalies. The returned anomaly object will have an AnomalyEndDate in the specified time range.

  • StartDate (string) -- [REQUIRED]

    The first date an anomaly was observed.

  • EndDate (string) --

    The last date an anomaly was observed.

type Feedback:

string

param Feedback:

Filters anomaly results by the feedback field on the anomaly object.

type TotalImpact:

dict

param TotalImpact:

Filters anomaly results by the total impact field on the anomaly object. For example, you can filter anomalies GREATER_THAN 200.00 to retrieve anomalies, with an estimated dollar impact greater than 200.

  • NumericOperator (string) -- [REQUIRED]

    The comparing value that's used in the filter.

  • StartValue (float) -- [REQUIRED]

    The lower bound dollar value that's used in the filter.

  • EndValue (float) --

    The upper bound dollar value that's used in the filter.

type NextPageToken:

string

param NextPageToken:

The token to retrieve the next set of results. Amazon Web Services provides the token when the response from a previous call has more results than the maximum page size.

type MaxResults:

integer

param MaxResults:

The number of entries a paginated response contains.

rtype:

dict

returns:

Response Syntax

{
    'Anomalies': [
        {
            'AnomalyId': 'string',
            'AnomalyStartDate': 'string',
            'AnomalyEndDate': 'string',
            'DimensionValue': 'string',
            'RootCauses': [
                {
                    'Service': 'string',
                    'Region': 'string',
                    'LinkedAccount': 'string',
                    'LinkedAccountName': 'string',
                    'UsageType': 'string',
                    'Impact': {
                        'Contribution': 123.0
                    }
                },
            ],
            'AnomalyScore': {
                'MaxScore': 123.0,
                'CurrentScore': 123.0
            },
            'Impact': {
                'MaxImpact': 123.0,
                'TotalImpact': 123.0,
                'TotalActualSpend': 123.0,
                'TotalExpectedSpend': 123.0,
                'TotalImpactPercentage': 123.0
            },
            'MonitorArn': 'string',
            'Feedback': 'YES'|'NO'|'PLANNED_ACTIVITY'
        },
    ],
    'NextPageToken': 'string'
}

Response Structure

  • (dict) --

    • Anomalies (list) --

      A list of cost anomalies.

      • (dict) --

        An unusual cost pattern. This consists of the detailed metadata and the current status of the anomaly object.

        • AnomalyId (string) --

          The unique identifier for the anomaly.

        • AnomalyStartDate (string) --

          The first day the anomaly is detected.

        • AnomalyEndDate (string) --

          The last day the anomaly is detected.

        • DimensionValue (string) --

          The dimension for the anomaly (for example, an Amazon Web Services service in a service monitor).

        • RootCauses (list) --

          The list of identified root causes for the anomaly.

          • (dict) --

            The combination of Amazon Web Services service, linked account, linked account name, Region, and usage type where a cost anomaly is observed, along with the dollar and percentage amount of the anomaly impact. The linked account name will only be available when the account name can be identified.

            • Service (string) --

              The Amazon Web Services service name that's associated with the cost anomaly.

            • Region (string) --

              The Amazon Web Services Region that's associated with the cost anomaly.

            • LinkedAccount (string) --

              The member account value that's associated with the cost anomaly.

            • LinkedAccountName (string) --

              The member account name value that's associated with the cost anomaly.

            • UsageType (string) --

              The UsageType value that's associated with the cost anomaly.

            • Impact (dict) --

              The dollar impact for the root cause.

              • Contribution (float) --

                The dollar amount that this root cause contributed to the anomaly's TotalImpact.

        • AnomalyScore (dict) --

          The latest and maximum score for the anomaly.

          • MaxScore (float) --

            The maximum score that's observed during the AnomalyDateInterval.

          • CurrentScore (float) --

            The last observed score.

        • Impact (dict) --

          The dollar impact for the anomaly.

          • MaxImpact (float) --

            The maximum dollar value that's observed for an anomaly.

          • TotalImpact (float) --

            The cumulative dollar difference between the total actual spend and total expected spend. It is calculated as TotalActualSpend - TotalExpectedSpend.

          • TotalActualSpend (float) --

            The cumulative dollar amount that was actually spent during the anomaly.

          • TotalExpectedSpend (float) --

            The cumulative dollar amount that was expected to be spent during the anomaly. It is calculated using advanced machine learning models to determine the typical spending pattern based on historical data for a customer.

          • TotalImpactPercentage (float) --

            The cumulative percentage difference between the total actual spend and total expected spend. It is calculated as (TotalImpact / TotalExpectedSpend) * 100. When TotalExpectedSpend is zero, this field is omitted. Expected spend can be zero in situations such as when you start to use a service for the first time.

        • MonitorArn (string) --

          The Amazon Resource Name (ARN) for the cost monitor that generated this anomaly.

        • Feedback (string) --

          The feedback value.

    • NextPageToken (string) --

      The token to retrieve the next set of results. Amazon Web Services provides the token when the response from a previous call has more results than the maximum page size.