This week on Doing Stupid AWS Projects Until I Get an AWS Job we consider the noble egg and its cost. Why eggs? Blame user u/yeamonn who last week wrote:
Can we get a price of eggs dashboard?
I said:
It’ll be done by Friday.
Edit: Maybe Sunday, my wife and I just started playing Split/Fiction, recommend.
While I still recommend Split/Fiction, I finished the project today (slow night on the ol’ helpdesk). Other users including u/TheBrianiac and u/premiumgrapes suggested demonstrating IaC, while other users suggested including a devlog to demonstrate my process and how I solve problems. While the projects may be stupid, I’m not, so I take good advice when I hear it.
Before going any further, we need a disclaimer since I got - not fussed at, but perhaps warned about Amazons Non-Compete Agreement by a fellow on Slack. Thus, I feel it is prudent to say: I am not seeking a job outside of Amazon nor am I trying to sell anything, I just want a AWS job so I can get paid to make cool things and collect more Peccy Pins.
What Is It?
This project is a serverless price-tracking system that fetches the cost of a dozen Kroger-brand Grade A large white eggs once per day in several Appalachian cities. It stores the data in an S3 bucket, processes it into an HTML report, and republishes the report to S3 for public viewing. The entire deployment is automated via AWS SAM, and users can customize it to track any other grocery item Kroger’s API supports. The goal was to build something lightweight, scalable, and – most importantly – cheap to run indefinitely.
The goal here – after all – is to get AWS to give me money, not the other way around.
Tech Stack – Optimized for Maximum Cheapness
Given the cost constraints, pricing influenced almost every technical decision:
- Data Source: Most major grocers (looking at you, Wal-Mart) hide their pricing behind multiple layers of blockers, but Kroger offers a free, public API, making them the clear choice for this. (My wife and I joked about programmatically planning our grocery shopping this weekend.)
- Compute: Fully serverless. An AWS Lambda function, triggered daily by EventBridge, fetches the latest price for Kroger-brand Grade A large white eggs. The Lambda function generates the HTML and publishes a new front-end HTML page each run.
- Storage & Hosting: Data is stored in S3 as a CSV, hosting by S3.
- Automation: The entire deployment is handled via AWS SAM, making it easy to tweak and redeploy.
- Flexibility: I added custom UPC tracking, so users can swap out the default egg UPC for any other item Kroger’s API supports by simply making minor adjustments to the Python. It’s effectively a general-purpose price tracker now. A secondary python script could be created allowing for even easier customization of the core Lambda.
Framework Check
Operational Excellence
The project is designed to be fully automated. AWS SAM streamlines deployment, while EventBridge triggers the Lambda function once per day without requiring external cron jobs. Logging is handled via CloudWatch, allowing for easy monitoring and debugging; since EventBridge does not automatically retry failed Lambda invocations, any failure handling would need to be built into the Lambda itself, but for now, a simple error log suffices.
Security
The Lambda function follows the principle of least privilege, having access only to the specific S3 bucket and CloudWatch logs it needs. API keys for Kroger are stored securely in AWS Secrets Manager rather than being hardcoded. The generated HTML report is hosted on S3 with public read-only access restricted to just that file; this prevents unauthorized modifications.
Reliability
If Kroger’s API is temporarily unavailable, the system will retain previous price data instead of breaking; since EventBridge does not retry failures, a future enhancement could be adding a retry mechanism within the Lambda function.
Performance Efficiency
The system is built to be as lightweight as possible. Lambda runs only when needed, keeping costs low. S3 serves static HTML, eliminating the need for a backend server; there’s no database per se, which reduces complexity and further optimizes cost.
Cost Optimization
Every choice in this project prioritizes low cost. AWS Lambda usage remains within free-tier limits for normal use. S3 storage is extremely cheap since it only holds a small CSV file and an HTML page; by skipping QuickSight, I’ve kept monthly costs effectively at zero while still providing useful price tracking. If the CSV grows to big, its arbitrary to modify the Lambda to prune old data.
Thoughts & Lessons Learned
One thing I kept thinking about during this project was whether Lambda really is the cheapest option for this kind of workload. Serverless is great because it scales down to zero, but given that this function runs once a day and isn’t particularly time-sensitive, I wonder if a spot EC2 instance could be a viable alternative. With the right lifecycle management, I could potentially spin up a cheap spot instance, run the job, and shut it down; maybe even at a lower cost than Lambda over time. It would add complexity, but it’s an interesting trade-off to consider.
Another idea that came up while troubleshooting the data collection was scraping price data using a headless browser and AI-based text recognition. Many retailers, especially large ones like Wal-Mart, block API access or require annoying authentication hurdles to access pricing data; but if a browser can render it, an AI can read it. A simple approach could be taking automated screenshots of price listings, then running them through OCR (Optical Character Recognition) or a vision-based AI model to extract the price. That method would be resilient against changes in site structure and could be generalized for almost any product from any retailer. It feels like the kind of approach that’s both incredibly dumb and oddly effective; which fits the spirit of this whole project.
These are the sorts of ideas that pop up when working through a problem like this. Even if they don’t make it into this project, they’re worth tucking away for future experiments.
Questions for r/aws
- My goal was to demonstrate basic competency and understanding of IaC? Do you feel this project demonstrates that in a way legible to hiring managers? If not, what would you like to see?
- Another goal was to demonstrate the same basic competency but with working with relatively live data sets and if not, what would you like to see?
- How do you like your eggs?
- What do you want me to make for my next project.
Thanks for reading, if you want more info check out the readme on the GitHub. Equally, I got around to pushing my other projects there.
(There probably won’t be a project this coming week, I’m going to try to finish grinding out the SAA).