AWS essentials, setting budgets and alarms

So you’ve created your first account with AWS and you keep hearing things like “pay as you go” and how “cheap” cloud can be, you also see a lot of references to AWS “free tier” options and think this seems pretty good. Then you get comfortable in AWS and start expanding out into more and more services and then bill arrives…

kelly-sikkema-xoU52jUVUXA-unsplash

It’s very common for AWS new comers to get swept away in cloud and caught with big bills, It happened to me more than once when I was starting out, it’s happens more than you think. So let’s dive into a few things that you might want to do when you setup your first AWS account, before you start building.

I’ll be discussing the following:

  • AWS billing
  • AWS budgets
  • AWS cost explorer
  • AWS support

We’ll be tackling all of this within AWS and won’t need any third party services, I’ll also give you some tips about what to do with an unexpected bill. Hint: you can’t pay with bezo bucks

Backstory

Most of the examples follow an old way to setup billing alarms, that use to with a CloudWatch alarm for the EstimatedCharges metric, this could be created in billing section in CloudWatch but only in the us-east-1 region. Once that had been setup you needed to create an SNS topic and subscribe via email to the alert. AWS are continually improving this space have done a bit in the space to simplify the process and give customers more visibility but also include forecasting.

Example: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/monitor_estimated_charges_with_cloudwatch.html

We’ll be using Budgets instead: https://aws.amazon.com/blogs/aws-cost-management/getting-started-with-aws-budgets/

AWS Budgets

There is where we’ll be doing most of our work, you can find budgets in the My Billing Dashboard off the top menu where you login is from the AWS console or by searching for budget in the big services search box in console.

Screen-Shot-2020-10-11-at-12.53.07-am

If you’ve landed in billing you’ll need to hit the Budgets button to get into the budget service, if you arrived from the search box, you’re already here.

Screen-Shot-2020-10-11-at-12.53.19-am

At this point you can click the Create Budget button to begin the process, here are some key parameters:

  • Period (suggest monthly)
  • Recurring
  • Fixed budget
  • Budget amount (suggest $30-$50 USD)
  • Actual costs
  • Percentage 80%
  • Email to receive alerts
    • Note: There is no SNS requirement for emails with budgets

Lazy but awesome way

If the above is too hard (I hear you, no judgement) I have created an AWS CDK and CloudFormation. If you don’t know what these are, it’s just storing the configuration as code.

I’ve hooked it up to a Deploy Stack button, push the button to setup the above in your region:

Launch Stack

Note: CloudFormation will ask for your email and budget to set, after that just next, next, a+b+up+down+up+down+up, accept to deploy.

This all happens in your account, and the code is available on github to review, chop and change as needed:

talkncloud/aws
all things cloud from IaC to full apps. Contribute to talkncloud/aws development by creating an account on GitHub.

Tidy up

If you ever want to remove what was deployed above just going in CloudFormation in the AWS console and select the stack and delete it. This will remove the configuration in Budgets and the stack like it was never there.

Review what we have

If you look in AWS Budgets now you should have a single item with the threshold you setup. Here is a preview of what a busy view would look like:

budgets screenshot

And if you select a budget you can drill down further in the spending to see what’s up.

getting started budget screenshot

Cost explorer

It’s worth mentioning the AWS Cost Explorer at this point, you may find that once you start looking at costs you’ll have more questions than answers. The AWS Cost Explorer can help you drill even further into your account activity, this is where you can choose services or tags to filter out some of the noise. So you if find yourself struggling to make sense of it all, check AWS Cost Explorer, there are some nice charts, it’s all point and click.

OK, I’ve gone way over budget is there anything I can do?

I’ve said it before and I’ll say it again, the AWS Support channels are fantastic, use them. You don’t need to be on a paid support plan to access billing support. Go to the support section and raise a new request, let AWS know the situation and see if they can help.

Screen-Shot-2020-10-11-at-1.35.03-am

I can say that AWS have been more than reasonable with my early mistakes and racking up bills. It isn’t always the case and with the above alarm configuration set up you’ll be able to get onto before it gets out of hand.

This is all free right?

Always read the fine print, AWS Budgets is a service and there is a fee once you go past 2 budgets, so with this single budget, you’re golden and it is eligible for the free usage. Always check the service pricing details page with any service you use. e.g AWS Budget Pricing

Final thoughts

Keeping cloud billing under control is a tricky business, this is really just starting out and giving you something to be alerted that you might have an issue. When you start digging you’ll soon realise that it’s actually harder than you think to design, estimate, track actual versus design estimates and then forecast.

I much prefer AWS Budgets over the previous method of integration with CloudWatch, metrics etc. Budgets gives you more functionality and it is easier to use. I’ll look at doing a follow up to extend this example to use slack notifications, which is a neat little feature.

Hit me up if any questions, suggestions etc. Happy building!

Related Posts

Wtf is construct hub

If you’ve ever seen my github repo you’ll know there are a bunch of cdk style projects in there that are usually paired with a blog explaining the details.

Read more

The death of forestry.io

When I migrated from Ghost Pro to hugo I stumbled across forestry.io, a CMS for my static site. It seemed to be everything I was looking for, something to bridge that small gap between writing markdown content and having a nice editor with workflows.

Read more

No fuss no muss TypeScript Lambda with CDK

One of the great things about AWS Lambda is the flexibility to develop functions in a bunch of different languages like Python, Node.

Read more