How I Migrated a Monolith Cron Job to a Serverless Architecture
A brief background about the app It’s an app where users upload their data into categories. The app processes that data, runs some additional calculations and aggregations, and stores everything in a database. After that, users can view the resulting data in charts and grids on the website. There’s also a requirement to capture that data and upload it as CSV files to an S3 bucket — daily, per account and per category. There are around 20 categories and 10,000 accounts. So in total, the app needs to upload about 200,000 CSV files to S3 every day. How it was It all started with a simple cron job that ran a script every day at 5 AM. The script did 3 things per account and category: Loaded data from the MySQL database Prepared the CSV file Uploaded it to S3 Here’s what it looked like: Problems

A brief background about the app
It’s an app where users upload their data into categories. The app processes that data, runs some additional calculations and aggregations, and stores everything in a database. After that, users can view the resulting data in charts and grids on the website.
There’s also a requirement to capture that data and upload it as CSV files to an S3 bucket — daily, per account and per category.
There are around 20 categories and 10,000 accounts. So in total, the app needs to upload about 200,000 CSV files to S3 every day.
How it was
It all started with a simple cron job that ran a script every day at 5 AM.
The script did 3 things per account and category:
- Loaded data from the MySQL database
- Prepared the CSV file
- Uploaded it to S3
Here’s what it looked like:
Problems