Automatically E-Mail Your AWS Bill to Your Finance Team

Sheehan Alam
Appetite for Cloud Formation
2 min readMay 28, 2019

Mo’ Money Mo’ Problems

There is nothing like opening your inbox with urgent and high priority e-mails from your company’s financial controller asking about why your department’s AWS bill is over budget. As a good IT leader, you are ready and armed with data to discuss the overages.

Shockingly enough, AWS does not make it easy to see the line by line details for your bill. Sure, they automatically send you an invoice every month summarizing how much you’ve spent, but to truly understand your costs in the cloud, and to justify them, you must be able to access detailed billing.

“CSV Files To the Rescue” - Said No One Ever

Buried in the AWS Billing Preferences console, you can enable a detailed billing report that dumps an hourly digest of all of your incurred AWS costs as a CSV file. At the end of the month, this CSV file is is a line by line record of all of your AWS spend (I’m talking over 10,000 lines of pennywise charges).

With a little bit of Terraform and Lambda magic, we can automatically send the detailed billing report to our finance department at the end of the month. This detailed billing report will have columns for your tags, so if you properly setup your cost allocation tags for all of your resources, your finance department can slice and dice costs by cost center in Excel (trust me, they aren’t going to log in to AWS and use Athena or Redshift to analyze this data).

Recipe for Automating Detailed Billing Reports

  1. Enable Detailed Billing Reports in AWS Billing Console
  2. Pick an S3 bucket to dump reports
  3. Create a Lambda function that will trigger on a specific date
  4. Implement the Lambda function to locate the appropriate CSV by name and attach to an Simple E-mail Service (SES) action

Download The Code

I understand, implementing this is toil; Time better spent developing features or talking to customers. Drop your name and e-mail address and I’ll send over a fully configurable Terraform module that will set everything up in 1 minute.

Click Here to Sign Up For the Code

Fix the Real Problem, Identify AWS Waste

When every minute & second counts, it’s important to understand how to use the right AWS services and proper configuration to keep costs in-line. My company Tappforce, helps businesses analyze their AWS bill and reduce them by 20% or more. Lets get in touch.

--

--