Just a quick search on the internet will turn up countless stories of people lamenting surprise bills from AWS. Some are relatively small and come from new users not realizing they were outside of the free tier, and some are hilarious huge and happen to experienced customers, and of course everything in between as well.
One of the simplest things you can do to help prevent an unfortunate surprise, especially when youâre just getting started, is to set up an AWS Budget. This is one of the endless list of AWS services that a surprising number of people probably have no idea even exists.
You can of course navigate to the service in the web console and set things up from there, but if youâve been following the previous posts of this newsletter, you know weâre perfectly set up to do it with Infrastructure as Code instead!
Letâs take a look at the Pulumi code to set up a very simple budget:
import * as aws from '@pulumi/aws'; | |
new aws.budgets.Budget('total-monthly-cost', { | |
name: 'total-monthly-cost', | |
budgetType: 'COST', | |
limitAmount: '10', | |
limitUnit: 'USD', | |
timeUnit: 'MONTHLY', | |
notifications: [{ | |
comparisonOperator: 'GREATER_THAN', | |
threshold: 100, | |
thresholdType: 'PERCENTAGE', | |
notificationType: 'FORECASTED', | |
subscriberEmailAddresses: ['<your-email@company.com>'] | |
}], | |
}); |
This simple budget sets an expected maximum spending limit of $10 a month, perfect if youâre just getting started. You can provide one, or multiple email addresses that will be notified if the forecasted spend for the month exceeds the programmed limit. Maybe you started up an expensive GPU EC2 instance for a couple hours to try out some ML training and forgot to turn it off. Now youâll get an email about it quickly instead of waiting until the bill comes as a surprise!
You can do a lot more with AWS Budgets too depending on your needs:
Create a âzero spendâ budget to be notified if you do anything outside the free tier.
Create budgets for individual services (for example, just EC2 or S3 usage).
Track budgets by metrics of usage, as opposed to just cost.
You can even have automatic actions taken when budget limits are reached! If a budget for EC2 usage is reached, it can be set up to stop or terminate instances without any manual action needed.
As with all things AWS, thereâs a lot of flexibility and room to do basically whatever you want. Just take a look at AWSâ own blog on using the capabilities. Even just the simplest of budgets like the one above though can go a long way, and I highly encourage all users to take advantage of the service to protect themselves from spooky surprise bills.
Hey Tim thank you for writing this up. I do think that it is very important to point out that there is nothing you can do in AWS to have an actual hard spending limit. You made a note about turning some things off as a reaction to passing a threshold but there is nothing that you can really do in terms of having your bill completely stop or account completely stop once you hit a certain amount of money.
The use of automated billing places the onus on users to thwart unethical billing practices such as what AWS and many online ventures now practice. AWS is only one of many. who offer free trials for period of time, and also require a credit card for obtaining a free trial. Many users do not realize they will automatically be billed at the end of the free trial unless they opt out. Many users do not read (if there is a statement) they will be billed at the end of the free trial. Cancellation of free trials can be difficult and are not easily found on vendor's web website. Frequently I have to "Google" how to cancel the account. The most ethical way would be to. require actively subscribing at the end of a free trial. Also if it is a free trial, why the credit card requirement. This practice is already becoming a standard in the industry. The practice should be examined and perhaps regulated by the FTC or other regulatory body. My bank will allow me to report these events as fraud, and will credit my account for these actions. It may require my debit card or credit card to be cancelled and a new one issued. i suggest to never use an ACH or direct debit from the accout. Obviously the banks are aware of this issue and strongly favor the card holder. My bank investigates each occurence and examines the web commerce disclosures. In three years I have never had my bank refuse my request to reverse the charges. Another suggestion is to set a cap on the amount anyone can charge on your account. The onus to avoid this should not be on the buyer. Ii ran into this problem with AWS several years ago and it took quite an effort to have it reversed, and the account cancelled. In fact I could not cancel the AWS account unless I paid the bill. I never did use the AWS account, and will never use AWS again.