Skip to content

Instantly share code, notes, and snippets.

@maguzzi
Created January 14, 2024 19:01
Show Gist options
  • Save maguzzi/2103834f2054d96db296169896a5bf11 to your computer and use it in GitHub Desktop.
Save maguzzi/2103834f2054d96db296169896a5bf11 to your computer and use it in GitHub Desktop.
Budget and monitor cloudformation stack
{
"AWSTemplateFormatVersion": "2010-09-09",
"Parameters": {
"EmailAddressForNotificationParameter": {
"Description": "Email address for the notification",
"Type": "String"
}
},
"Description": "Static website budget",
"Resources": {
"Budget": {
"Type": "AWS::Budgets::Budget",
"Properties": {
"Budget": {
"BudgetLimit": {
"Amount": "6",
"Unit": "USD"
},
"TimeUnit": "MONTHLY",
"BudgetName": "A few bucks a month",
"BudgetType": "COST"
},
"NotificationsWithSubscribers": [
{
"Notification": {
"NotificationType": "FORECASTED",
"ComparisonOperator": "GREATER_THAN",
"Threshold": 80,
"ThresholdType": "PERCENTAGE"
},
"Subscribers": [
{
"SubscriptionType": "EMAIL",
"Address": { "Ref": "EmailAddressForNotificationParameter"}
}
]
}
]
}
},
"AnomalyServiceMonitor": {
"Type" : "AWS::CE::AnomalyMonitor",
"Properties" : {
"MonitorDimension" : "SERVICE",
"MonitorName" : "Website monitor",
"MonitorType": "DIMENSIONAL"
}
},
"AnomalySubscription": {
"Type": "AWS::CE::AnomalySubscription",
"Properties": {
"SubscriptionName": "Email to stakeholder",
"Threshold": 10,
"Frequency": "DAILY",
"MonitorArnList": [
{ "Ref": "AnomalyServiceMonitor"}
],
"Subscribers": [
{
"Type": "EMAIL",
"Address": { "Ref": "EmailAddressForNotificationParameter"}
}
]
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment