A lambda that sends daily AWS bill notifications

leroykayanda

leroykayanda

Posted on February 5, 2022

A lambda that sends daily AWS bill notifications

The SMS/Email will be as below.

AWS Account
Yesterday Usage : Kshs. 730
Month To Date Bill : Kshs. 12,640
Forecasted Bill : Kshs. 20,479

The code is on github.

This helps you keep track of your AWS spending in order to avoid surprises at the end of the month

How it works
It uses cost explorer APIs to get your bill details and then sends them using SNS.

IAM permissions required for the lambda role
cost explorer
sns

How to set it up
Create a python lambda function
Initialize the environment variables
Schedule the lambda function to run periodically using CloudWatch events

Lambda Environment Variables

Image description

currency : name of your local currency e.g kshs
dollar_exchange_rate : the function converts from dollars to your local currency
sns_topic : arn of your sns topic
subject : subject of the message that is sent

💖 💪 🙅 🚩
leroykayanda
leroykayanda

Posted on February 5, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related