DEV Community

leroykayanda
leroykayanda

Posted on

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

Top comments (0)