CostExplorer.Client.
get_anomalies
(**kwargs)¶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
response = 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
)
[REQUIRED]
Assigns the start and end dates for retrieving cost anomalies. The returned anomaly object will have an AnomalyEndDate
in the specified time range.
The first date an anomaly was observed.
The last date an anomaly was observed.
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.
The comparing value that's used in the filter.
The lower bound dollar value that's used in the filter.
The upper bound dollar value that's used in the filter.
dict
Response Syntax
{
'Anomalies': [
{
'AnomalyId': 'string',
'AnomalyStartDate': 'string',
'AnomalyEndDate': 'string',
'DimensionValue': 'string',
'RootCauses': [
{
'Service': 'string',
'Region': 'string',
'LinkedAccount': 'string',
'UsageType': 'string',
'LinkedAccountName': 'string'
},
],
'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 Service in a service monitor).
RootCauses (list) --
The list of identified root causes for the anomaly.
(dict) --
The combination of Amazon Web Service, linked account, linked account name, Region, and usage type where a cost anomaly is observed. The linked account name will only be available when the account name can be identified.
Service (string) --
The Amazon Web 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.
UsageType (string) --
The UsageType
value that's associated with the cost anomaly.
LinkedAccountName (string) --
The member account name value that's associated with the cost anomaly.
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.
Exceptions
CostExplorer.Client.exceptions.LimitExceededException
CostExplorer.Client.exceptions.InvalidNextTokenException