AWS::CE::AnomalyMonitor - AWS CloudFormation

This is the new CloudFormation Template Reference Guide. Please update your bookmarks and links. For help getting started with CloudFormation, see the AWS CloudFormation User Guide.

AWS::CE::AnomalyMonitor

The AWS::CE::AnomalyMonitor resource is a Cost Explorer resource type that continuously inspects your account's cost data for anomalies, based on MonitorType and MonitorSpecification. The content consists of detailed metadata and the current status of the monitor object.

Syntax

To declare this entity in your CloudFormation template, use the following syntax:

JSON

{ "Type" : "AWS::CE::AnomalyMonitor", "Properties" : { "MonitorDimension" : String, "MonitorName" : String, "MonitorSpecification" : String, "MonitorType" : String, "ResourceTags" : [ ResourceTag, ... ] } }

YAML

Type: AWS::CE::AnomalyMonitor Properties: MonitorDimension: String MonitorName: String MonitorSpecification: String MonitorType: String ResourceTags: - ResourceTag

Properties

MonitorDimension

For customer managed monitors, do not specify this field.

For AWS 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.

Required: No

Type: String

Allowed values: SERVICE | LINKED_ACCOUNT | TAG | COST_CATEGORY

Update requires: Replacement

MonitorName

The name of the monitor.

Required: Yes

Type: String

Pattern: [\S\s]*

Minimum: 0

Maximum: 1024

Update requires: No interruption

MonitorSpecification

The array of MonitorSpecification in JSON array format. For instance, you can use MonitorSpecification to specify a tag, Cost Category, or linked account for your custom anomaly monitor. For further information, see the Examples section of this page.

Required: No

Type: String

Update requires: Replacement

MonitorType

The type of the monitor.

Set this to DIMENSIONAL for an AWS managed monitor. AWS 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 AWS 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.

Required: Yes

Type: String

Allowed values: DIMENSIONAL | CUSTOM

Update requires: Replacement

ResourceTags

Property description not available.

Required: No

Type: Array of ResourceTag

Minimum: 0

Maximum: 200

Update requires: Replacement

Return values

Ref

When you pass the logical ID of this resource to the intrinsic Ref function, Ref returnsMonitorArn. For example:

           { "Ref": "myAnomalySubscriptionLogicalName" }        

For more information about using the Ref function, see Ref.

Fn::GetAtt

The Fn::GetAtt intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using the Fn::GetAtt intrinsic function, see Fn::GetAtt.

CreationDate

The date when the monitor was created.

DimensionalValueCount

The value for evaluated dimensions.

LastEvaluatedDate

The date when the monitor last evaluated for anomalies.

LastUpdatedDate

The date when the monitor was last updated.

MonitorArn

The Amazon Resource Name (ARN) value for the monitor.

Examples

Service monitor

The following example creates a service anomaly monitor.

JSON

{ "Resources": { "AnomalyServiceMonitor": { "Type": "AWS::CE::AnomalyMonitor", "Properties": { "MonitorName": "MonitorName", "MonitorType": "DIMENSIONAL", "MonitorDimension": "SERVICE" } } } }

YAML

Resources: AnomalyServiceMonitor: Type: 'AWS::CE::AnomalyMonitor' Properties: MonitorName: 'MonitorName' MonitorType: 'DIMENSIONAL' MonitorDimension: 'SERVICE'

Anomaly monitor with tags

The following example creates a custom anomaly monitor with tags.

JSON

{ "Resources": { "CustomAnomalyMonitorWithTags": { "Type": "AWS::CE::AnomalyMonitor", "Properties": { "MonitorName": "MonitorName", "MonitorType": "CUSTOM", "MonitorSpecification": " { \"Tags\" : { \"Key\" : \"Tag Key\", \"Values\" : [ \"TagValue1\", \"TagValue2\" ] } }" } } } }

YAML

Resources: CustomAnomalyMonitorWithTags: Type: 'AWS::CE::AnomalyMonitor' Properties: MonitorName: "MonitorName" MonitorType: "CUSTOM" MonitorSpecification: ' { "Tags" : { "Key" : "Tag Key", "Values" : [ "TagValue1", "TagValue2" ] } }'

Anomaly monitor with Cost Category

The following example creates a custom anomaly monitor with a Cost Category.

JSON

{ "Resources": { "CustomAnomalyMonitorWithCC": { "Type": "AWS::CE::AnomalyMonitor", "Properties": { "MonitorName": "MonitorName", "MonitorType": "CUSTOM", "MonitorSpecification": " { \"CostCategories\" : { \"Key\" : \"CostCategoryKey\", \"Values\" : [ \"CostCategoryValue\" ] } }" } } } }

YAML

Resources: CustomAnomalyMonitorWithCC: Type: 'AWS::CE::AnomalyMonitor' Properties: MonitorName: "MonitorName" MonitorType: "CUSTOM" MonitorSpecification: ' { "CostCategories" : { "Key" : "CostCategoryKey", "Values" : [ "CostCategoryValue" ] } }'

Anomaly monitor with linked account

The following example creates a custom anomaly monitor with a linked account.

JSON

{ "Resources": { "CustomAnomalyMonitorWithLinkedAccount": { "Type": "AWS::CE::AnomalyMonitor", "Properties": { "MonitorName": "MonitorName", "MonitorType": "CUSTOM", "MonitorSpecification": " { \"Dimensions\" : { \"Key\" : \"LINKED_ACCOUNT\", \"Values\" : [ \"123456789012\", \"123456789013\" ] } }" } } } }

YAML

Resources: CustomAnomalyMonitorWithLinkedAccount: Type: 'AWS::CE::AnomalyMonitor' Properties: MonitorName: "MonitorName" MonitorType: "CUSTOM" MonitorSpecification: ' { "Dimensions" : { "Key" : "LINKED_ACCOUNT", "Values" : [ "123456789012", "123456789013" ] } }'

Attaching subscriptions to monitors

The following example shows two anomaly monitors attached to an anomaly subscription.

JSON

{ "Resources": { "CustomAnomalyMonitorWithLinkedAccount": { "Type": "AWS::CE::AnomalyMonitor", "Properties": { "MonitorName": "MonitorName", "MonitorType": "CUSTOM", "MonitorSpecification": " { \"Dimensions\" : { \"Key\" : \"LINKED_ACCOUNT\", \"Values\" : [ \"123456789012\", \"123456789013\" ] } }" } }, "AnomalyServiceMonitor": { "Type": "AWS::CE::AnomalyMonitor", "Properties": { "MonitorName": "MonitorName", "MonitorType": "DIMENSIONAL", "MonitorDimension": "SERVICE" } }, "AnomalySubscription": { "Type": "AWS::CE::AnomalySubscription", "Properties": { "SubscriptionName": "SubscriptionName", "Threshold": 100, "Frequency": "DAILY", "MonitorArnList": [ { “Ref”: "CustomAnomalyMonitorWithLinkedAccount"}, { "Ref": "AnomalyServiceMonitor"} ], "Subscribers": [ { "Type": "EMAIL", "Address": "abc@def.com" } ] } } } }

YAML

Resources: CustomAnomalyMonitorWithLinkedAccount: Type: 'AWS::CE::AnomalyMonitor' Properties: MonitorName: "MonitorName" MonitorType: "CUSTOM" MonitorSpecification: ' { "Dimensions" : { "Key" : "LINKED_ACCOUNT", "Values" : [ "123456789012", "123456789013" ] } }' AnomalyServiceMonitor: Type: 'AWS::CE::AnomalyMonitor' Properties: MonitorName: 'MonitorName' MonitorType: 'DIMENSIONAL' MonitorDimension: 'SERVICE' AnomalySubscription: Type: 'AWS::CE::AnomalySubscription' Properties: SubscriptionName: "SubscriptionName" Threshold: 100 Frequency: "DAILY" MonitorArnList: [ !Ref CustomAnomalyMonitorWithLinkedAccount, !Ref AnomalyServiceMonitor ] Subscribers: [ { "Type": "EMAIL", "Address": "abc@def.com" } ]

See also