• About Me
  • Projects
  • WebApp
  • Archive

Barnaby Baron. Exploring AWS.

  • Building a serverless automated Cost Visibility report

Building a serverless automated Cost Visibility report

2024-04-12 3 min read Projects Barny Baron

Journey: 📊 Community Builder 📊

Subject matter: Building on AWS

Task: Building a serverless automated Cost Visibility report

I recently shared an article relating to cost visibility on LinkedIn Here

This project is all about observability, and understanding what is happening in the account.

Using the 6 Pillars of the AWS Well-Architected Framework, Cost Optimisation will be achieved in this build.

I will be setting up a serverless cost monitoring and reporting system that uses Email to notify on spending patterns.

AWS

Credit: This serverless architecture was created using some guidance from Pushkar Joshi on Medium Here and TechStoryLines Here. I picked bits from each article to help me fulfill my requirements.

What did I use to build this environment?

  • Lambda [with layers]
  • Amazon Simple Email Service
  • Amazon EventBridge
  • AWS Management Console
  • IAM

What is built?

  • A configured, layered Lambda function using Python
  • A call to the AWS Cost Explorer API
  • A verified email service
  • An Amazon EventBridge configuration to call the Lambda function on a rate-based schedule

Using the principle of least privilege:

Taken from the AWS documentation Here:

“The principle of least privilege states that identities should only be permitted to perform the smallest set of actions necessary to fulfill a specific task.”

To obtain the correct Lambda Permission for this, I used some further documentation Here.

I used the Cost Explorer API which enables me to programmatically query data for the cost and usage of AWS services.

This solution uses a Lambda function to query aggregated data from the API, format that data, and send it to a defined list of recipients.

Once I had configured all of the areas, I successfully received a cost visibility report!

Some of the highlights…

Lambda Function:

Lambda Fn

Lambda policy:

Policy

Lambda Layer:

Layer

SES verified email:

SES

EventBridge Schedule:

Schedule

Cost visibility report:

Report

My interpretation of the architecture:

Architecture

I hope you have enjoyed the article, I enjoyed the build!

Cloud

Community Builder Serverless Lambda EventBridge SES
Latest posts
  • Designing a Formula 1 Race Track and gaining insights from Amazon Nova
  • Year 2 - AWS Community Builder
  • Troubleshooting an EKS Pod creation error - Persistent Volume Controller Failed Binding
  • Building an EKS cluster and mounting an S3 bucket within a pod using the CSI Driver
  • Sopra Steria Merch Delivery!
  • AWS Community Builders Application Window!
  • Building a VPC and provisioning an EC2 instance using Modules!
Categories
  • AWS News (84)
  • Projects (29)
  • Exploring (19)
  • Troubleshooting (10)
  • General (8)
  • Quotes (5)
  • Video (3)
Social media
Archive
© 2025 by Barny Baron
Powered by Bilberry Hugo Theme