AWS::CE::AnomalyMonitor - AWS CloudFormation

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

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

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 returns MonitorArn. 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