Skip to content

Script to grab the rent due each month, integrated with Selenium, and AWS services (Lambda, EventBridge, CodeBuild, CodePipeline, CodeDeploy).

Notifications You must be signed in to change notification settings

Defconn4/RentAutoCalculator

Repository files navigation

Easy Links

LinkedIn

Automated Monthly Rent Calculator

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
  1. About The Project
  2. Getting Started
  3. Usage
  4. What I Learned
  5. Roadmap
  6. Contact

About The Project

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.

The Story

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.

Built With

  • 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.

(back to top)

Getting Started

I will provide configuration steps on how to set up the project for deployment with AWS.

Prerequisites

  • 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.
  • Selenium WebDriver and appropriate binaries for headless Chrome (for local testing).
  • AWS CLI configured with appropriate IAM permissions.

Installation

  1. Clone the Repository

    git clone https://github.com/your_github_username/Automated-Monthly-Rent-Calculator.git
    cd Automated-Monthly-Rent-Calculator
  2. Install Python Dependencies

    pip install -r requirements.txt
  3. 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.

(back to top)

Usage

This project runs as a monthly CRON job on AWS Lambda. Here’s how it works:

  1. Monthly Trigger:

    • The Lambda function is scheduled to run once a month using an AWS CRON expression (via CloudWatch Events/EventBridge).
  2. 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.
  3. Calculation and Reporting:

    • The main handler in lambda_function.py combines the scraped data with static rent calculations and creates an email report.
  4. Email Notification:

    • The report is sent to the designated email address using AWS SES.
  5. CI/CD Pipeline:

    • CodePipeline and CodeBuild automatically update the Lambda function whenever code is pushed to GitHub.

(back to top)

What I Learned

  1. AWS Cloud Services Integration:

    • I gained hands-on experience with AWS Lambda, CodeBuild, CodePipeline, CodeDeploy by automating deployments from GitHub.
  2. Serverless Architecture:

    • I learned how to build and deploy a serverless application that handles scheduled tasks and integrates multiple AWS services.
  3. Selenium Web Scraping:

    • I improved my skills with Selenium for automating browser interactions and scraping dynamic web pages.
  4. Problem Solving & Automation:

    • I transformed a tedious, manual process into an automated solution, showcasing an entrepreneurial mindset and efficient problem solving.

(back to top)

Roadmap

  1. 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.
  2. 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.
  3. Complete CI/CD Integration:

    • Fully integrate CodePipeline and CodeBuild to automatically update the Lambda function.
  4. Secure Credential Management:

    • Integrate AWS Secrets Manager for secure handling of login credentials.
  5. Enhanced Error Handling:

    • Improve logging and error notifications for the Selenium scraper.
  6. Portfolio Documentation:

    • Expand documentation and add examples to better showcase this project in my personal portfolio.

(back to top)

Contact

(back to top)

About

Script to grab the rent due each month, integrated with Selenium, and AWS services (Lambda, EventBridge, CodeBuild, CodePipeline, CodeDeploy).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages