AWS Budgets and their Setup
AWS Budgets is a cost governance service that lets you set custom budgets for cost, usage, Reserved Instances (RIs), and Savings Plans, then notifies you when actual or forecasted amounts exceed defined thresholds. You can scope budgets to the whole account or narrow them by service, linked account (in AWS Organizations), tags, Cost Categories, region, and more. Notifications can go to email or Amazon SNS (which you can connect to Slack via AWS Chatbot).
How to set up AWS Budgets (Console)
- Open the Billing and Cost Management console and go to Budgets, then Create budget.
- Choose a budget type (Cost), select time period (Monthly), set start date, and enter your budget amount and currency.
- Add filters if needed, for example Service = Amazon S3, or Tag = Environment:Prod.
- Add alerts, such as 80% for Actual and 100% for Forecasted, and choose recipients (email or SNS topic).
- Name the budget and create it. Repeat for other teams, services, or accounts as needed.
How to set up using AWS CLI
Below is a minimal example that creates a monthly cost budget filtered by a tag and two notifications (80% actual, 100% forecasted):
ACCOUNT_ID=123456789012
aws budgets create-budget \
--account-id "$ACCOUNT_ID" \
--budget '{
"BudgetName": "monthly-prod-cost",
"BudgetLimit": { "Amount": "5000", "Unit": "USD" },
"CostFilters": { "TagKeyValue": ["Environment$Prod"] },
"CostTypes": {
"IncludeTax": true,
"IncludeSubscription": true,
"UseAmortized": true,
"UseBlended": false
},
"TimeUnit": "MONTHLY",
"BudgetType": "COST"
}'
aws budgets create-notification \
--account-id "$ACCOUNT_ID" \
--budget-name "monthly-prod-cost" \
--notification '{
"NotificationType": "ACTUAL",
"ComparisonOperator": "GREATER_THAN",
"Threshold": 80.0,
"ThresholdType": "PERCENTAGE"
}' \
--subscribers '[
{ "SubscriptionType": "EMAIL", "Address": "finance@example.com" },
{ "SubscriptionType": "EMAIL", "Address": "ops@example.com" }
]'
aws budgets create-notification \
--account-id "$ACCOUNT_ID" \
--budget-name "monthly-prod-cost" \
--notification '{
"NotificationType": "FORECASTED",
"ComparisonOperator": "GREATER_THAN",
"Threshold": 100.0,
"ThresholdType": "PERCENTAGE"
}' \
--subscribers '[
{ "SubscriptionType": "EMAIL", "Address": "oncall@example.com" }
]'
How to set up using CloudFormation
AWSTemplateFormatVersion: '2010-09-09'
Resources:
MonthlyProdCostBudget:
Type: AWS::Budgets::Budget
Properties:
Budget:
BudgetName: monthly-prod-cost
BudgetType: COST
TimeUnit: MONTHLY
BudgetLimit:
Amount: 5000
Unit: USD
CostFilters:
TagKeyValue:
- Environment$Prod
CostTypes:
IncludeTax: true
IncludeSubscription: true
UseAmortized: true
UseBlended: false
NotificationsWithSubscribers:
- Notification:
NotificationType: ACTUAL
ComparisonOperator: GREATER_THAN
Threshold: 80
ThresholdType: PERCENTAGE
Subscribers:
- SubscriptionType: EMAIL
Address: finance@example.com
- SubscriptionType: EMAIL
Address: ops@example.com
- Notification:
NotificationType: FORECASTED
ComparisonOperator: GREATER_THAN
Threshold: 100
ThresholdType: PERCENTAGE
Subscribers:
- SubscriptionType: EMAIL
Address: oncall@example.com
