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...
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
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.
We'll be using Budgets instead: https://aws.amazon.com/blogs/aws-cost-management/getting-started-with-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.
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.
At this point you can click the Create Budget button to begin the process, here are some key parameters:
- Period (suggest monthly)
- 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:
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:
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:
And if you select a budget you can drill down further in the spending to see what's up.
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.
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
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!