AWS::CE::AnomalyMonitor - Amazon CloudFormation
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

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 Amazon 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

The dimensions to evaluate.

Required: No

Type: String

Allowed values: SERVICE

Update requires: Replacement

MonitorName

The name of the monitor.

Required: Yes

Type: String

Minimum: 0

Maximum: 1024

Pattern: [\S\s]*

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 possible type values.

Required: Yes

Type: String

Allowed values: CUSTOM | DIMENSIONAL

Update requires: Replacement

ResourceTags

Property description not available.

Required: No

Type: List of ResourceTag

Update requires: Replacement

Return values

Ref

When you pass the logical ID of this resource to the intrinsic Reffunction, Refreturns MonitorArn. For example:

           { "Ref": "myAnomalySubscriptionLogicalName" }        

For more information about using the Reffunction, see Ref.

Fn::GetAtt

The Fn::GetAttintrinsic 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::GetAttintrinsic 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