How AWS Budgets Can Prevent Costly Surprises

How AWS Budgets Can Prevent Costly Surprises

Or: how to prevent your CFO from turning 50 shades of red


2 min read

Imagine someone asking, "What's your average daily cloud expenditure?" Would you know the exact figure?

Even if you did due diligence and are an expert on the hourly rates and usage patterns, are you sure there won't be any surprises in your future costs?

It's hard to make such a promise.

AWS is wild. It's a massive sandbox filled with bells and whistles and traps and pitfalls, challenging to master, where "mishaps" like the above are one wrong configuration away from happening.

Given that cost spikes can and will happen, the least we can do is set up our system to warn us as soon as they occur rather than when the next AWS bill comes.

Enter AWS Budgets

AWS Budgets are simple to understand and set up:

  1. Decide an amount and a frequency (e.g. daily, monthly)

  2. Tag your resources

  3. Set a threshold

  4. Provide a valid email

  5. ????

  6. Profit

You're not limited to a single budget; for instance, you can set different thresholds for the same resources and amount. Once you cross a threshold, you'll get an email that looks like this:

And really, this is almost all there is to know about AWS Budgets.

Now, if you're a cloud engineer, read on.
If you're a CFO, find the nearest cloud engineer and send them this article.
If you don't have engineers available, reach out, and we'll see how we can help you!

Getting started

The easiest way to get started is through the AWS Console.

The second easiest is to use DataChef's cost monitoring construct and install it via npm or pip.

Then, it's as easy as including this snippet in your existing CDK code:

// app.ts
const app = new cdk.App();
const awesomeStack = new AwesomeStack(app, "AwesomeStack", {});

const costMonitoring = new ApplicationCostMonitoring(
    applicationName: "AwesomeApp",
    monthlyLimitInDollars: 200,
    subscribers: [""],
    costAllocationTag: "project"

The above code will:

  • Tag all resources in awesomeStack with project: AwesomeApp.

  • Create two daily and three monthly budgets with different thresholds for each.

  • Subscribe to each budget using the provided email(s).

Adapt the snippet to your specific use case, and that's it!

Warning: to use cost allocation tags, one must first activate them. However, this operation can only be done by the billing account. Ensure your chosen one is activated; otherwise, the budgets won't work!