INF-53Required
Give every account a budget with alerts
Create a monthly budget in code for every account. Alert the owning team when the forecast passes 80 percent and when spending passes 100 percent.
How to do it
Create the budget in the account baseline, so no account starts without one. Send alerts to a team channel or group address, never one person. Turn on the provider's cost anomaly detection for jumps inside the month, such as AWS Cost Anomaly Detection. On sandbox and preview accounts, add an action that stops spending when the budget runs out.
Examples
Terraform example
resource "aws_budgets_budget" "monthly" {
name = "shop-production-monthly"
budget_type = "COST"
limit_amount = "2000"
limit_unit = "USD"
time_unit = "MONTHLY"
notification {
comparison_operator = "GREATER_THAN"
threshold = 80
threshold_type = "PERCENTAGE"
notification_type = "FORECASTED"
subscriber_sns_topic_arns = [aws_sns_topic.cost_alerts.arn]
}
notification {
comparison_operator = "GREATER_THAN"
threshold = 100
threshold_type = "PERCENTAGE"
notification_type = "ACTUAL"
subscriber_sns_topic_arns = [aws_sns_topic.cost_alerts.arn]
}
}
How to check
Every account in the organization has a budget with both alerts and is covered by a cost anomaly monitor. A test alert reaches the team channel.
Sources
Related rules
- AID-62 Cap what your coding agents can spend in AI-assisted development
- INF-14 Start every account from one baseline in Infrastructure and environments
- INF-72 Track cost per request in Infrastructure and environments
- INF-56 Show the cost of each change in review in Infrastructure and environments
- INF-57 Buy commitment discounts for steady use in Infrastructure and environments
- INF-66 Price data transfer and per-request charges before launch in Infrastructure and environments
- AIF-29 Measure cost and speed in every eval run in AI features
- AIF-42 Price every model call and cap the spend in AI features
- DEN-6 Cap what each query and each month can cost in Data engineering
- MED-29 Watch data sent out per file and per owner in Files and media
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/infrastructure/cost-and-ownership/budgets-for-every-account">Agent Wranglers infrastructure and environments playbook</a>. In code you write, add a comment next to it with the same link.