AWS Builder Center
Automating Monthly AWS Invoice Delivery for Finance

Automating Monthly AWS Invoice Delivery for Finance

A serverless workflow that automates monthly AWS invoice delivery to Finance and keeps billing records archived in S3.

Downloading an AWS invoice and forwarding it to Finance is a small task, but it repeats every month.
I wanted to remove that manual step, so I built a serverless workflow that handles the process automatically.

Architecture

The workflow uses:
  • EventBridge Scheduler
  • AWS Lambda
  • AWS Invoicing API
  • AWS Cost Explorer
  • Amazon S3
  • Amazon SES
  • CloudWatch
EventBridge triggers Lambda during the monthly billing period.
Lambda checks for the previous month’s invoice. Once it becomes available, the function downloads the official PDF, stores a copy in S3, gets the monthly cost from Cost Explorer, and sends everything to Finance through SES.
I also use an S3 delivery marker to make sure the same invoice is not emailed more than once.

One Issue I Hit

During testing, the Lambda function had object-level S3 permissions but still failed while checking the bucket.
The missing permission was:
s3:ListBucket

Adding that permission fixed the issue.
It was a good reminder that bucket-level and object-level S3 permissions are separate.

Verification

After deployment, I verified that:
  • the invoice was retrieved successfully
  • the PDF was archived in S3
  • Cost Explorer returned the billing total
  • SES delivered the email
  • CloudWatch recorded the execution

Infrastructure

The AWS resources are deployed using Terraform so the workflow can be reproduced without configuring everything manually in the console.
The complete implementation is available here:
A more detailed version of this project, including additional implementation notes and screenshots, is available on my Hashnode blog
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article