AI cost governance: read AI spend, then set an alert-only budget
Two Cost Explorer reads, one alert-only budget, nothing that can block. Everything created is deleted.
AWS Cloud
AWS Billing and Cost Management
AI services in the account
Presenter
quickstart.py
Cost Explorer API
AI spend by model and principal
AWS Budgets
daily AI cost budget, alert at 80%
Amazon SNS topic
no subscriptions
Amazon Bedrock
plus Kiro and AWS Quick usage
Not created by the script
A BLOCK_SERVICE budget action. Only that action makes AWS Budgets
apply a service control policy that denies Amazon Bedrock requests.
1
2
3
4
5
6
1
2
3
4
5
6
LINES
Read spend
Create, read back, delete
Usage priced within minutes
Alert when spend passes 80%
FLOW
AI usage is priced and reaches Billing and Cost Management within minutes.
The script reads AI spend twice: by model for 7 days, by IAM principal for today.
It creates an SNS topic that only AWS Budgets can publish to.
It creates one daily AI cost budget with an 80 percent alert to the topic.
It reads the budget back until the budget shows today's spend.
An alert would go to the topic. The script then deletes the budget and topic.