AWS Builder Center

How to Set a Hard Spending Cap on AWS in 15 Minutes (Student Guide)

A step-by-step guide to stop surprise AWS bills: set a budget, get alerts at 80%, and auto-block new billable resources at 100% using AWS Budgets Actions and an IAM deny policy. No Lambda or code needed. Built for students and solo builders.

Why this matters

One forgotten NAT gateway or EC2 instance can turn a free-tier project into a surprise bill. AWS Budgets only emails you by default. With one extra step, it can also block new spending automatically.

Step 1: Create a monthly budget

  1. Open Billing and Cost Management > Budgets > Create budget
  1. Choose Cost budget and Monthly
  1. Set your limit (e.g. $10)

Step 2: Add alerts

  • 80% actual: email you
  • 100% forecasted: email you early

Step 3: Create a deny policy

Create an IAM policy that blocks costly actions:
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Deny",
"Action": [
"ec2:RunInstances",
"rds:CreateDBInstance",
"ec2:CreateNatGateway"
],
"Resource": "*"
}]
}

Step 4: Attach it automatically with Budgets Actions

  1. In your budget, go to Alerts > Add action
  1. Trigger at 100%
  1. Action type: Apply IAM policy to your user/role
  1. Pick the deny policy from Step 3
  1. Choose automatic execution
Optional: add a second action to stop specific EC2/RDS instances.

Step 5: Test it

Set a temporary budget of $0.01 and confirm the action triggers. Delete the test afterwards.

Limitations (read this)

  • Budget data refreshes a few times a day, so enforcement is not instant. Set your cap below what you can actually afford.
  • Storage and already-running resources keep costing money until you remove them.
  • Also enable Free Tier usage alerts and Cost Anomaly Detection.

What I wish AWS offered

A native one-click "Hard Cap" mode in the console. If you agree, please vote for my Wishlist request: [add your wish link here]

Takeaway

Five steps, no code, and you can experiment on AWS without bill anxiety.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article