Created
April 10, 2023 09:49
-
-
Save stekern/435771d8e0f13f665432aac30661c193 to your computer and use it in GitHub Desktop.
CloudFormation template for creating a monthly AWS budget with email notifications.
This file contains hidden or 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
# NOTE: In order for IAM users and roles to have access to AWS billing and cost management, | |
# you'll first need to activate IAM access using your AWS root user. You can follow the guide | |
# at the link below if you haven't already configured this. | |
# https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_billing.html?icmpid=docs_iam_console#tutorial-billing-step1 | |
AWSTemplateFormatVersion: 2010-09-09 | |
Description: | | |
Creates an AWS Budgets Budget that notifies you by email once you're on track to exceed the monthly budget." | |
Parameters: | |
Email: | |
Type: String | |
Description: "An email address to send budget notifications to." | |
Budget: | |
Type: String | |
Default: "50" | |
Description: "The monthly budget in USD." | |
Resources: | |
MonthlyBudget: | |
Type: AWS::Budgets::Budget | |
Properties: | |
Budget: | |
BudgetLimit: | |
Amount: !Ref Budget | |
Unit: USD | |
BudgetType: COST | |
TimeUnit: MONTHLY | |
TimePeriod: | |
Start: "1225864800" | |
NotificationsWithSubscribers: | |
- Notification: | |
ComparisonOperator: GREATER_THAN | |
NotificationType: ACTUAL | |
Threshold: 80 | |
ThresholdType: PERCENTAGE | |
Subscribers: | |
- SubscriptionType: EMAIL | |
Address: !Ref Email | |
- Notification: | |
ComparisonOperator: GREATER_THAN | |
NotificationType: FORECASTED | |
Threshold: 100 | |
ThresholdType: PERCENTAGE | |
Subscribers: | |
- SubscriptionType: EMAIL | |
Address: !Ref Email |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment