Skip to content

Instantly share code, notes, and snippets.

@AlexChesters
Created July 12, 2018 22:45
Show Gist options
  • Save AlexChesters/5a820b3d80e214ca69b950831404138f to your computer and use it in GitHub Desktop.
Save AlexChesters/5a820b3d80e214ca69b950831404138f to your computer and use it in GitHub Desktop.
An example CloudFormation template for an AWS Budget with an alarm
{
"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