anomaly_monitors
Creates, updates, deletes, gets or lists an anomaly_monitors resource.
Overview
| Name | anomaly_monitors |
| Type | Resource |
| Id | aws.ce.anomaly_monitors |
Fields
The following fields are returned by SELECT queries:
- get_anomaly_monitors
| Name | Datatype | Description |
|---|---|---|
creation_date | string | The date when the monitor was created. (pattern: <code>(\d{4}-\d{2}-\d{2})(T\d{2}:\d{2}:\d{2}Z)?</code>) |
dimensional_value_count | integer | The value for evaluated dimensions. |
last_evaluated_date | string | The date when the monitor last evaluated for anomalies. (pattern: <code>(\d{4}-\d{2}-\d{2})(T\d{2}:\d{2}:\d{2}Z)?</code>) |
last_updated_date | string | The date when the monitor was last updated. (pattern: <code>(\d{4}-\d{2}-\d{2})(T\d{2}:\d{2}:\d{2}Z)?</code>) |
monitor_arn | string | The Amazon Resource Name (ARN) value. (pattern: <code>[\S\s]*</code>) |
monitor_dimension | string | For customer managed monitors, do not specify this field. For Amazon Web Services managed monitors, this field controls which cost dimension is automatically analyzed by the monitor. For TAG and COST_CATEGORY dimensions, you must also specify MonitorSpecification to configure the specific tag or cost category key to analyze. (SERVICE, LINKED_ACCOUNT, TAG, COST_CATEGORY) |
monitor_name | string | The name of the monitor. (pattern: <code>[\S\s]*</code>) |
monitor_specification | object | An Expression object used to control what costs the monitor analyzes for anomalies. For Amazon Web Services managed monitors: If MonitorDimension is SERVICE or LINKED_ACCOUNT, do not specify this field If MonitorDimension is TAG, set this field to { "Tags": { "Key": "your tag key" } } If MonitorDimension is COST_CATEGORY, set this field to { "CostCategories": { "Key": "your cost category key" } } For customer managed monitors: To track linked accounts, set this field to { "Dimensions": { "Key": "LINKED_ACCOUNT", "Values": [ "your list of up to 10 account IDs" ] } } To track cost allocation tags, set this field to { "Tags": { "Key": "your tag key", "Values": [ "your list of up to 10 tag values" ] } } To track cost categories, set this field to{ "CostCategories": { "Key": "your cost category key", "Values": [ "your cost category value" ] } } |
monitor_type | string | The type of the monitor. Set this to DIMENSIONAL for an Amazon Web Services managed monitor. Amazon Web Services managed monitors automatically track up to the top 5,000 values by cost within a dimension of your choosing. Each dimension value is evaluated independently. If you start incurring cost in a new value of your chosen dimension, it will automatically be analyzed by an Amazon Web Services managed monitor. Set this to CUSTOM for a customer managed monitor. Customer managed monitors let you select specific dimension values that get monitored in aggregate. For more information about monitor types, see Monitor types in the Billing and Cost Management User Guide. (DIMENSIONAL, CUSTOM) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_anomaly_monitors | select | region | Retrieves the cost anomaly monitor definitions for your account. You can filter using a list of cost anomaly monitor Amazon Resource Names (ARNs). | |
create_anomaly_monitor | insert | region, AnomalyMonitor | Creates a new cost anomaly detection monitor with the requested type and monitor specification. | |
update_anomaly_monitor | update | region, MonitorArn | Updates an existing cost anomaly monitor. The changes made are applied going forward, and doesn't change anomalies detected in the past. | |
delete_anomaly_monitor | delete | region | Deletes a cost anomaly monitor. |
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
- get_anomaly_monitors
Retrieves the cost anomaly monitor definitions for your account. You can filter using a list of cost anomaly monitor Amazon Resource Names (ARNs).
SELECT
creation_date,
dimensional_value_count,
last_evaluated_date,
last_updated_date,
monitor_arn,
monitor_dimension,
monitor_name,
monitor_specification,
monitor_type
FROM aws.ce.anomaly_monitors
WHERE region = '{{ region }}' -- required
;
INSERT examples
- create_anomaly_monitor
- Manifest
Creates a new cost anomaly detection monitor with the requested type and monitor specification.
INSERT INTO aws.ce.anomaly_monitors (
AnomalyMonitor,
ResourceTags,
region
)
SELECT
'{{ AnomalyMonitor }}' /* required */,
'{{ ResourceTags }}',
'{{ region }}'
RETURNING
monitor_arn
;
# Description fields are for documentation purposes
- name: anomaly_monitors
props:
- name: region
value: "{{ region }}"
description: Required parameter for the anomaly_monitors resource.
- name: AnomalyMonitor
description: |
The cost anomaly detection monitor object that you want to create.
value:
MonitorArn: "{{ MonitorArn }}"
MonitorName: "{{ MonitorName }}"
CreationDate: "{{ CreationDate }}"
LastUpdatedDate: "{{ LastUpdatedDate }}"
LastEvaluatedDate: "{{ LastEvaluatedDate }}"
MonitorType: "{{ MonitorType }}"
MonitorDimension: "{{ MonitorDimension }}"
MonitorSpecification:
Or:
- Or: "{{ Or }}"
And: "{{ And }}"
Not:
Or:
- Or: "{{ Or }}"
And: "{{ And }}"
Not:
Or: "{{ Or }}"
And: "{{ And }}"
Not: "{{ Not }}"
Dimensions: "{{ Dimensions }}"
Tags: "{{ Tags }}"
CostCategories: "{{ CostCategories }}"
Dimensions:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
Tags:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
CostCategories:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
And:
- Or: "{{ Or }}"
And: "{{ And }}"
Not:
Or: "{{ Or }}"
And: "{{ And }}"
Not: "{{ Not }}"
Dimensions: "{{ Dimensions }}"
Tags: "{{ Tags }}"
CostCategories: "{{ CostCategories }}"
Dimensions:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
Tags:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
CostCategories:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
Not:
Or: "{{ Or }}"
And: "{{ And }}"
Not: "{{ Not }}"
Dimensions: "{{ Dimensions }}"
Tags: "{{ Tags }}"
CostCategories: "{{ CostCategories }}"
Dimensions:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
Tags:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
CostCategories:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
Dimensions:
Key: "{{ Key }}"
Values:
- "{{ Values }}"
MatchOptions:
- "{{ MatchOptions }}"
Tags:
Key: "{{ Key }}"
Values:
- "{{ Values }}"
MatchOptions:
- "{{ MatchOptions }}"
CostCategories:
Key: "{{ Key }}"
Values:
- "{{ Values }}"
MatchOptions:
- "{{ MatchOptions }}"
And:
- Or: "{{ Or }}"
And: "{{ And }}"
Not:
Or:
- Or: "{{ Or }}"
And: "{{ And }}"
Not:
Or: "{{ Or }}"
And: "{{ And }}"
Not: "{{ Not }}"
Dimensions: "{{ Dimensions }}"
Tags: "{{ Tags }}"
CostCategories: "{{ CostCategories }}"
Dimensions:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
Tags:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
CostCategories:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
And:
- Or: "{{ Or }}"
And: "{{ And }}"
Not:
Or: "{{ Or }}"
And: "{{ And }}"
Not: "{{ Not }}"
Dimensions: "{{ Dimensions }}"
Tags: "{{ Tags }}"
CostCategories: "{{ CostCategories }}"
Dimensions:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
Tags:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
CostCategories:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
Not:
Or: "{{ Or }}"
And: "{{ And }}"
Not: "{{ Not }}"
Dimensions: "{{ Dimensions }}"
Tags: "{{ Tags }}"
CostCategories: "{{ CostCategories }}"
Dimensions:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
Tags:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
CostCategories:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
Dimensions:
Key: "{{ Key }}"
Values:
- "{{ Values }}"
MatchOptions:
- "{{ MatchOptions }}"
Tags:
Key: "{{ Key }}"
Values:
- "{{ Values }}"
MatchOptions:
- "{{ MatchOptions }}"
CostCategories:
Key: "{{ Key }}"
Values:
- "{{ Values }}"
MatchOptions:
- "{{ MatchOptions }}"
Not:
Or:
- Or: "{{ Or }}"
And: "{{ And }}"
Not:
Or: "{{ Or }}"
And: "{{ And }}"
Not: "{{ Not }}"
Dimensions: "{{ Dimensions }}"
Tags: "{{ Tags }}"
CostCategories: "{{ CostCategories }}"
Dimensions:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
Tags:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
CostCategories:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
And:
- Or: "{{ Or }}"
And: "{{ And }}"
Not:
Or: "{{ Or }}"
And: "{{ And }}"
Not: "{{ Not }}"
Dimensions: "{{ Dimensions }}"
Tags: "{{ Tags }}"
CostCategories: "{{ CostCategories }}"
Dimensions:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
Tags:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
CostCategories:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
Not:
Or:
- Or: "{{ Or }}"
And: "{{ And }}"
Not:
Or: "{{ Or }}"
And: "{{ And }}"
Not: "{{ Not }}"
Dimensions: "{{ Dimensions }}"
Tags: "{{ Tags }}"
CostCategories: "{{ CostCategories }}"
Dimensions:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
Tags:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
CostCategories:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
And:
- Or: "{{ Or }}"
And: "{{ And }}"
Not:
Or: "{{ Or }}"
And: "{{ And }}"
Not: "{{ Not }}"
Dimensions: "{{ Dimensions }}"
Tags: "{{ Tags }}"
CostCategories: "{{ CostCategories }}"
Dimensions:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
Tags:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
CostCategories:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
Not:
Or: "{{ Or }}"
And: "{{ And }}"
Not: "{{ Not }}"
Dimensions: "{{ Dimensions }}"
Tags: "{{ Tags }}"
CostCategories: "{{ CostCategories }}"
Dimensions:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
Tags:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
CostCategories:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
Dimensions:
Key: "{{ Key }}"
Values:
- "{{ Values }}"
MatchOptions:
- "{{ MatchOptions }}"
Tags:
Key: "{{ Key }}"
Values:
- "{{ Values }}"
MatchOptions:
- "{{ MatchOptions }}"
CostCategories:
Key: "{{ Key }}"
Values:
- "{{ Values }}"
MatchOptions:
- "{{ MatchOptions }}"
Dimensions:
Key: "{{ Key }}"
Values:
- "{{ Values }}"
MatchOptions:
- "{{ MatchOptions }}"
Tags:
Key: "{{ Key }}"
Values:
- "{{ Values }}"
MatchOptions:
- "{{ MatchOptions }}"
CostCategories:
Key: "{{ Key }}"
Values:
- "{{ Values }}"
MatchOptions:
- "{{ MatchOptions }}"
DimensionalValueCount: {{ DimensionalValueCount }}
- name: ResourceTags
description: |
An optional list of tags to associate with the specified AnomalyMonitor . You can use resource tags to control access to your monitor using IAM policies. Each tag consists of a key and a value, and each key must be unique for the resource. The following restrictions apply to resource tags: Although the maximum number of array members is 200, you can assign a maximum of 50 user-tags to one resource. The remaining are reserved for Amazon Web Services use The maximum length of a key is 128 characters The maximum length of a value is 256 characters Keys and values can only contain alphanumeric characters, spaces, and any of the following: _.:/=+@- Keys and values are case sensitive Keys and values are trimmed for any leading or trailing whitespaces Don’t use aws: as a prefix for your keys. This prefix is reserved for Amazon Web Services use
value:
- Key: "{{ Key }}"
Value: "{{ Value }}"
UPDATE examples
- update_anomaly_monitor
Updates an existing cost anomaly monitor. The changes made are applied going forward, and doesn't change anomalies detected in the past.
UPDATE aws.ce.anomaly_monitors
SET
MonitorArn = '{{ MonitorArn }}',
MonitorName = '{{ MonitorName }}'
WHERE
region = '{{ region }}' --required
AND MonitorArn = '{{ MonitorArn }}' --required
RETURNING
monitor_arn;
DELETE examples
- delete_anomaly_monitor
Deletes a cost anomaly monitor.
DELETE FROM aws.ce.anomaly_monitors
WHERE region = '{{ region }}' --required
;