What is AWS Budgets?
When you are in charge of cost control, you have spending limitations and want to know when real expenditure approaches or surpasses those limits. This is especially significant in the context of cloud computing, where people and automated systems have greater ability to build resources by design.
AWS Budgets provides two options for tracking expenses.
The AWS Management Console allows you to monitor how your consumption changes on a daily basis, but AWS Budgets allows you to have this view provided as a regular email report without signing in. A budget in AWS Budgets is a single, frequently updating cost or consumption statistic service for your AWS resources. Because of the deep nature of this AWS data, you may create various budgets to track this data across departments or dive down into different systems and resource kinds.
Instead of relying on regular reports to detect when expenses are about to exceed budget, you may set up budget alerts that can warn the appropriate individuals or trigger automatic measures such as restricting the account or shutting down particular AWS resources.
A solid foundation for cost control is the mix of routine reports and event-driven alerts sent to the relevant recipients.
AWS Budgets allows you to track service consumption, as well as utilization and coverage for Reserved Instances and Savings Plans, in addition to service pricing.
There is an AWS setup wizard that starts when you create a budget through the console. Within the wizard, there are “Info” links at the top of each page, which lead to more detailed instructions and AWS documentation.
Although you can use console for creating Budget, but in this blog we will demonstrate a simple CloudFormation template for creating a budget with threshold notifications in AWS Budgets, but first let's understand AWS Budgets.
Alerts are associated with a budget and can be produced when the budget is created or edited. They are made up of a threshold and a notice. The threshold includes a trigger that controls whether the warning is triggered when today's actual use or the anticipated consumption for the budget period exceeds the threshold.
- Notification: ComparisonOperator: GREATER_THAN NotificationType: ACTUAL Threshold: !Ref FirstThreshold ThresholdType: PERCENTAGE Subscribers: - SubscriptionType: EMAIL Address: !Ref Email
You may also set alerts to do automated actions when they fire, actions like stopping a specific EC2 and RDS instances, creating an IAM Role and so on.
Forecasting in AWS Budgets
You now have a second choice for how to configure your notifications thanks to forecasting. You might use actual spending to set up an alert to warn you, say, when you reach 70% of your monthly budget. You could want an alert based on forecasted overrun, such as 120 percent, using forecasting. The same budget, which supports a maximum of 5 notifications, can be used for both kinds of alerts. As with all forecasting, there will be some intelligence in the underlying algorithm, but it is solely based on your past usage patterns and may be inaccurate. Forecast warnings won't fire at all unless you already have enough consumption data (about 5 weeks).
- Notification: ComparisonOperator: GREATER_THAN NotificationType: FORECASTED Threshold: 100 ThresholdType: PERCENTAGE Subscribers: - SubscriptionType: EMAIL Address: !Ref Email
I have created an simple easy to deploy cloudformation to setup your budget, this template consists of two actual threshold notification alerts and one forecasted notification budget alert, all you need to do is enter your desired values and launch the template.
AWSTemplateFormatVersion: "2010-09-09" Description: Creates an AWS budget and notifies you when you exceed thresholds. Parameters: Name: Description: Name Type: String Default: Budget Amount: Description: Total budget for the month Type: Number Currency: Description: Currency Type: String Default: USD FirstThreshold: Description: Percentage of first threshold Type: Number Default: 75 SecondThreshold: Description: Percentage of second threshold Type: Number Default: 99 Email: Description: Email for notification Type: String Metadata: AWS::CloudFormation::Interface: ParameterGroups: - Parameters: - Name - Amount - Currency - FirstThreshold - SecondThreshold - Email Resources: MonthlyBudget: Type: AWS::Budgets::Budget Properties: Budget: BudgetName: !Ref Name BudgetLimit: Amount: !Ref Amount Unit: !Ref Currency TimeUnit: MONTHLY BudgetType: COST # You can add upto 5 notifications at your prefered level. NotificationsWithSubscribers: - Notification: ComparisonOperator: GREATER_THAN NotificationType: ACTUAL Threshold: !Ref FirstThreshold ThresholdType: PERCENTAGE Subscribers: - SubscriptionType: EMAIL Address: !Ref Email - Notification: ComparisonOperator: GREATER_THAN NotificationType: ACTUAL Threshold: !Ref SecondThreshold ThresholdType: PERCENTAGE Subscribers: - SubscriptionType: EMAIL Address: !Ref Email - Notification: ComparisonOperator: GREATER_THAN NotificationType: FORECASTED Threshold: 100 ThresholdType: PERCENTAGE Subscribers: - SubscriptionType: EMAIL Address: !Ref Email
Once budget is configured, Email budget reports are routinely sent out.
AWS keeps these reports basic, you may alter the following for a single report:
- Which budgets are covered? (you can include more than one).
- The frequency with which the report should be provided - daily, weekly, or monthly.
- A list of email addresses should be provided : who should receive the report.
AWS Budgets use underlying billing data to support you in different FinOps tasks. You can use budgets to understand, optimize, and control your AWS costs, and get better value for money from the cloud.
https://docs.aws.amazon.com/cost-management/latest/userguide/budgets-create.html https://docs.aws.amazon.com/cost-management/latest/userguide/budgets-create-filters.html https://docs.aws.amazon.com/ja_jp/AWSCloudFormation/latest/UserGuide/aws-resource-budgets-budget.html