Week 41: A budget alert is not a budget limit. Put hard spending caps on cloud and AI accounts
Simon Willison argues hard budget caps should be the default. How to set real limits on AWS, Google Cloud and AI APIs, and test that they actually stop.
September 30 to October 6. Not an exploit this week, but an attack every cloud tester eventually writes up: somebody gets hold of a key, or an agent loops overnight, and the bill does the damage. Some people call it denial of wallet.
What happened
On October 3, Simon Willison argued that pay-as-you-go services need hard budget caps on by default: hit the amount you set and the service stops and returns errors, instead of sending an email and carrying on (Simon Willison). His reasoning is that coding agents and personal agents make it very easy to spin up things that cost money. A warning email at midnight doesn’t help when the spending continues while you sleep. If someone wants to run uncapped, they should have to tick a box saying so.
The providers are moving, slowly. AWS added monthly spend limits for projects in its new simplified builder experience on September 16. When a project hits its limit, it’s paused for the rest of the month (Redreamality, remio). Google Cloud announced Spend Caps in July. But the defaults still favor unlimited spending, and the features differ in scope and in what they actually stop.
From a security point of view, a cap is a blast-radius control. A leaked key with a $50 ceiling is an annoyance. A leaked key with no ceiling is an incident.
Walkthrough: set limits, then prove they work
1. Know the difference before you configure anything. A budget or alert tells you. A cap or limit stops. Most consoles default to the first. For every service you pay for, look up which one you actually have.
2. AWS: an alert at minimum, plus an action that stops spending. This creates a $50 monthly budget that emails you at 80%:
aws budgets create-budget --account-id 123456789012 \
--budget '{"BudgetName":"monthly-cap","BudgetLimit":{"Amount":"50","Unit":"USD"},"TimeUnit":"MONTHLY","BudgetType":"COST"}' \
--notifications-with-subscribers '[{"Notification":{"NotificationType":"ACTUAL","ComparisonOperator":"GREATER_THAN","Threshold":80,"ThresholdType":"PERCENTAGE"},"Subscribers":[{"SubscriptionType":"EMAIL","Address":"you@example.com"}]}]'
That only warns. To make it stop something, attach a budget action (aws budgets create-budget-action). It can apply an IAM or SCP policy that denies new resource creation, or run an SSM document that stops EC2 and RDS instances when the threshold is crossed. On personal and side-project accounts, use the new project spend limits where your account has them.
3. Google Cloud: budgets, then caps.
gcloud billing budgets create --billing-account=XXXXXX-XXXXXX-XXXXXX \
--display-name="monthly-cap" --budget-amount=50USD \
--threshold-rule=percent=0.5 --threshold-rule=percent=0.9 --threshold-rule=percent=1.0
Budgets alone don’t stop anything. Where Spend Caps are available on your account, turn them on for projects that should never surprise you.
4. AI APIs: one project per use, each with its own limit. OpenAI, Anthropic and Google all let you split usage into projects or workspaces, each with its own keys and limits. Give every app and every agent its own, with a limit sized to what it should normally spend, not to your whole budget. Check in each console whether the limit blocks requests or only emails you. The answer isn’t the same everywhere.
5. Treat keys like card numbers. Keep AI and cloud keys out of front-end code and out of repos. Don’t paste them into hosted tools you don’t control. Rotate any key that has been shared. A separate low-limit key for each agent means one leak costs you one small budget.
6. Test the cap. Set a tiny limit on a throwaway project and push past it. Note what actually happens and how quickly. Providers don’t always say how much can still be charged after the limit trips, so treat the cap as the point where stopping begins, not an exact ceiling.
7. Watch for the attack, too. A sudden jump in spend on one key, usage at 3 a.m. when nobody works then, or calls to models you never use are all signs of a stolen key, not just a buggy agent. Most providers’ usage pages break spend down by key. Look at yours once a week.
On a cloud pentest, “what’s the most this key can cost you?” is now a question worth putting in the report.
New write-ups and both weekly posts land in the inbox — subscribe, or grab the RSS feed.