Created
July 12, 2018 22:45
-
-
Save AlexChesters/5a820b3d80e214ca69b950831404138f to your computer and use it in GitHub Desktop.
An example CloudFormation template for an AWS Budget with an alarm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Description": "A Budget, with alarm, to monitor My Component", | |
"Resources": { | |
"EmailTopic": { | |
"Type": "AWS::SNS::Topic", | |
"Properties": { | |
"Subscription": [ | |
{ | |
"Endpoint": "[email protected]", | |
"Protocol": "email" | |
} | |
] | |
} | |
}, | |
"EmailTopicPolicy": { | |
"Type": "AWS::SNS::TopicPolicy", | |
"Properties": { | |
"PolicyDocument": { | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Principal": { | |
"Service": "budgets.amazonaws.com" | |
}, | |
"Action": "sns:Publish", | |
"Resource": { | |
"Ref": "EmailTopic" | |
} | |
} | |
] | |
}, | |
"Topics": [ | |
{ | |
"Ref": "EmailTopic" | |
} | |
] | |
} | |
}, | |
"Budget": { | |
"Type": "AWS::Budgets::Budget", | |
"Properties": { | |
"NotificationsWithSubscribers": [ | |
{ | |
"Subscribers": [ | |
{ | |
"SubscriptionType": "SNS", | |
"Address": { | |
"Ref": "EmailTopic" | |
} | |
} | |
], | |
"Notification": { | |
"ComparisonOperator": "GREATER_THAN", | |
"NotificationType": "FORECASTED", | |
"Threshold": "100", | |
"ThresholdType": "PERCENTAGE" | |
} | |
} | |
], | |
"Budget": { | |
"BudgetName": "my-first-budget", | |
"BudgetLimit": { | |
"Amount": "100", | |
"Unit": "USD" | |
}, | |
"TimeUnit": "MONTHLY", | |
"BudgetType": "COST", | |
"CostFilters": { | |
"TagKeyValue": [ | |
"user:<TAG_NAME>$<TAG_VALUE>" | |
] | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment