Sub topic 13
Why a budget is an alert, not a spending cap
This chapter assumes you have already created the monthly-cost-budget budget from the previous chapter and can run AWS CLI commands. It explains what a budget does and doesn't do, so you don't count on it to protect you.
What a budget actually does
An AWS Budget compares your spend (or usage) against a number you set. When the comparison crosses a threshold, it sends a notification. That is all it does by default. It never blocks a request, stops a resource, or refuses a charge.
Your 20 USD budget is a tripwire, not a ceiling. If an instance keeps running after the alert, AWS keeps billing you for it.
Why the alert arrives late
Budgets read from billing data, and billing data lags behind real usage. AWS refreshes this data up to three times a day, so a runaway resource can spend for hours before the budget sees it.
Every step between A and E is time during which charges keep accruing. A budget limits how long you stay unaware, not how much you can spend.
Actual and forecasted alerts
You can set two kinds of notification:
| Type | Fires when | Use it for |
|---|---|---|
| `ACTUAL` | Spend so far passes the threshold | Confirming a problem has already happened |
| `FORECASTED` | AWS predicts month-end spend will pass the threshold | Getting an early warning |
Forecasts need some usage history, so a brand-new account may not produce them right away. Add a forecast alert next to your actual alert. This notifications.json replaces the earlier one:
[
{
"Notification": {
"NotificationType": "ACTUAL",
"ComparisonOperator": "GREATER_THAN",
"Threshold": 80,
"ThresholdType": "PERCENTAGE"
},
"Subscribers": [
{ "SubscriptionType": "EMAIL", "Address": "[email protected]" }
]
},
{
"Notification": {
"NotificationType": "FORECASTED",
"ComparisonOperator": "GREATER_THAN",
"Threshold": 100,
"ThresholdType": "PERCENTAGE"
},
"Subscribers": [
{ "SubscriptionType": "EMAIL", "Address": "[email protected]" }
]
}
]To see what the budget currently believes you have spent, query it:
aws budgets describe-budget \
--account-id 111122223333 \
--budget-name monthly-cost-budget \
--query 'Budget.CalculatedSpend'If the numbers look lower than the console's Cost Explorer, the lag is the likely reason.
Budget actions are not a hard cap
AWS Budgets can also run a budget action when a threshold is crossed. An action can attach an IAM policy or a service control policy, or stop certain EC2 and RDS instances. This is useful, but it has limits:
- It runs after the same data delay as an alert.
- It only touches what you configured. Storage, snapshots, data transfer, and other services keep charging.
- Stopping an instance does not stop its attached EBS volumes from billing.
Treat actions as a way to reduce damage, not to guarantee a maximum bill.
Common mistakes
- Ignoring the alert address. Alerts sent to an unread mailbox do nothing. Use an address you check daily, or a shared one that a team monitors.
- Setting only one threshold. A single 100 percent alert leaves you no time to react. Use several levels, such as 50, 80, and 100 percent.
- Assuming a budget is a safeguard. The real protection is the habit of reviewing resources, deleting what you don't use, and keeping permissions tight.
- Forgetting that subscriptions can need confirmation. If you send alerts to an SNS topic, the subscriber must confirm before messages arrive.
Exercise
You set a 20 USD budget with an actual alert at 100 percent. A misconfigured service spends 60 USD overnight. Why might the budget still show under 20 USD when you wake up, and what does this tell you about budgets?
Show answer
Billing data refreshes only up to three times a day, so the budget evaluates stale numbers. Charges also keep accruing until you stop the resource. This shows a budget is a delayed alert, not a spending cap. Add forecast alerts and lower thresholds such as 50 and 80 percent, and review running resources regularly.