A simple AWS-powered service that automates the monthly calculation of rent for my apartment and sends an email report. This script can be run locally or deployed via AWS.
I like to automate things and I had to find an excuse to use my AWS Cloud Practitioner knowledge lol.
Table of Contents
Every month, I used to manually enter rent details into a local Excel sheet and then send a group text to my roommates with the updated figures. This repetitive process was not only time-consuming but also error-prone.
After earning my AWS Cloud Practitioner Certification, I saw an opportunity to build a simple AWS service that automates this process. This project uses AWS Lambda (triggered by a monthly CRON schedule), CodeBuild, CodePipeline, and CodeDeploy to:
- Scrape my rent portal for the latest balance using Selenium.
- Calculate the rent share based on predefined parameters.
- Send an email with a detailed monthly rent calculation report.
I embarked on this project to solve a practical problem in my everyday life. Managing rent and splitting costs among roommates is just kinda annoying. I love automating tedious tasks and figured this would be a good way to actually make use of my Cloud Practitioner knowledge, so I hammered some AWS services in here.
- AWS Lambda – Serverless compute to run the monthly task.
- AWS CodeBuild – To package the project.
- AWS CodePipeline – To automate deployment from GitHub.
- AWS CodeDeploy – For updating the Lambda function.
- Python 3.10 – The programming language used.
- Selenium – For web scraping the rent portal.
- Boto3 – AWS SDK for Python.
- AWS SES – To send email reports.
I will provide configuration steps on how to set up the project for deployment with AWS.
- AWS Account with access to Lambda, CodeBuild, CodePipeline, CodeDeploy, and SES.
- Python 3.10 installed locally.
- Git installed.
- Download the Chrome Labs Chromium Binary to run Selenium here.
- If you don't want to peruse the versions, here is version 1.33.0.6943.53 for Win64.
- Selenium WebDriver and appropriate binaries for headless Chrome (for local testing).
- AWS CLI configured with appropriate IAM permissions.
-
Clone the Repository
git clone https://github.com/your_github_username/Automated-Monthly-Rent-Calculator.git cd Automated-Monthly-Rent-Calculator
-
Install Python Dependencies
pip install -r requirements.txt
-
Refer to the
deployment.md
file for further instructions on AWS. I did not want to clutter this README with a vast amount of instructions.
This project runs as a monthly CRON job on AWS Lambda. Here’s how it works:
-
Monthly Trigger:
- The Lambda function is scheduled to run once a month using an AWS CRON expression (via CloudWatch Events/EventBridge).
-
Rent Data Collection:
- When triggered, the Lambda function calls the Selenium scraper (rent_scraper.py), which logs into the rent portal, scrapes the current balance, and returns the data.
-
Calculation and Reporting:
- The main handler in lambda_function.py combines the scraped data with static rent calculations and creates an email report.
-
Email Notification:
- The report is sent to the designated email address using AWS SES.
-
CI/CD Pipeline:
- CodePipeline and CodeBuild automatically update the Lambda function whenever code is pushed to GitHub.
-
AWS Cloud Services Integration:
- I gained hands-on experience with AWS Lambda, CodeBuild, CodePipeline, CodeDeploy by automating deployments from GitHub.
-
Serverless Architecture:
- I learned how to build and deploy a serverless application that handles scheduled tasks and integrates multiple AWS services.
-
Selenium Web Scraping:
- I improved my skills with Selenium for automating browser interactions and scraping dynamic web pages.
-
Problem Solving & Automation:
- I transformed a tedious, manual process into an automated solution, showcasing an entrepreneurial mindset and efficient problem solving.
-
Local Script Usage:
- Add a separate directory with files to run this script locally instead of needing to rely on AWS, in the case of hitting free monthly usage limits like I currently have due to debugging.
-
Basic Automation:
- Automate monthly rent calculation and email reporting using AWS Lambda, SES, and scheduled CRON jobs. I am currently waiting for my AWS monthly free usage limits to reset for AWS CodeBuild and AWS CodePipeline.
-
Complete CI/CD Integration:
- Fully integrate CodePipeline and CodeBuild to automatically update the Lambda function.
-
Secure Credential Management:
- Integrate AWS Secrets Manager for secure handling of login credentials.
-
Enhanced Error Handling:
- Improve logging and error notifications for the Selenium scraper.
-
Portfolio Documentation:
- Expand documentation and add examples to better showcase this project in my personal portfolio.
-
Feel free to reach me at [email protected]
-
Project Link: https://github.com/Defconn4/RentAutoCalculator
-
LinkedIn: https://www.linkedin.com/in/frank-costantino-a4a61b133/