AWS Builder Center
Weekend Agent Challenge: Fridge Rot

Weekend Agent Challenge: Fridge Rot

Always on agent that checks your fridge daily, finds expiring food, and generates recipes using AI so you stop wasting food

Cloud Engineer

Vision & What the Agent Does

Email

I throw away food every week. Not because I buy too much, but because I forget what's in the fridge until it's too late. That bag of spinach I bought Monday? By Friday it's a science experiment. The chicken thighs I planned to cook Wednesday? Thursday night I order takeout. Friday morning they smell wrong.
Fridge Rot is a daily agent that checks my grocery inventory, finds what's about to expire, and generates a recipe using those dying ingredients. It runs at 7 AM every morning before I'm awake. By the time I check my email with coffee, there's a message telling me exactly what to cook tonight and making me feel bad if I don't.
What triggers it: Amazon EventBridge Scheduler, firing a cron expression daily at 7:00 AM UTC.
What it does on its own: Queries a DynamoDB table for items expiring today or tomorrow. If it finds any, it sends them to Amazon Bedrock (Nova Lite) with a prompt that asks for a quick recipe. The prompt has personality. It's a slightly disappointed home chef who hates food waste.
How it reports back: An HTML email via SES lands in my inbox. It categorizes items by urgency (expiring today vs. tomorrow), shows the full recipe with cook time and difficulty, and ends with a one-line guilt trip. Something like: "That spinach has been wilting for 5 days. It believed in you."
If nothing is expiring, it stays quiet. No empty emails.

How I Built It

I started with the data model. A fridge item needs a name, category, quantity, purchase date, and expiry date. DynamoDB with a simple hash key (item_id) and a scan filter on expiry_date. For a personal inventory of 10-20 items, a scan is fine. No need to over-engineer with GSIs for this scale.
The Lambda function is straightforward Python. It queries DynamoDB, groups items into "today" and "tomorrow" buckets, builds a prompt, calls Bedrock, formats the HTML email, and sends via SES. About 200 lines total.
The key decision was the model. Nova Lite over Nova Pro. Recipe generation doesn't need deep reasoning. It needs speed, variety, and a casual tone. Nova Lite handles that well at a fraction of the cost. I set  maxTokens  to 512 (enough for a recipe, not enough for the model to ramble) and  temperature  to 0.8 for variety so I don't get the same stir-fry suggestion every day.
The prompt took the most iteration. My first version produced generic recipes with no personality. The fix was giving it a character: "You are a helpful but slightly pushy home chef who hates food waste." That one line changed everything. The recipes got shorter, funnier, and more direct.
For deployment, I wrote a single bash script that creates all infrastructure from scratch: DynamoDB table, IAM roles with least-privilege policies, Lambda function, EventBridge Scheduler, and SES email verification. One command, five minutes, everything running. A matching teardown script removes it all cleanly.
The biggest challenge was timing. EventBridge Scheduler uses UTC, and I kept confusing my local timezone offset during testing. I added a manual invoke command to the README so I could test the full pipeline without waiting for the next scheduled run.

AWS Services Used / Architecture Overview

EventBridge Scheduler (daily cron) → Lambda (Python 3.12) → DynamoDB → Bedrock Nova Lite → SES → Inbox
Amazon EventBridge Scheduler triggers the Lambda daily at 7:00 AM UTC. I used Scheduler over the older CloudWatch Events rule because it has a cleaner API for one-off schedules and supports flexible time windows (though I set mine to exact).
EventBridge scheduler

AWS Lambda (Python 3.12, 256MB, 60s timeout) runs the agent logic. It's the orchestrator: reads data, calls the model, sends the email.
Amazon DynamoDB stores the grocery inventory. PAY_PER_REQUEST billing mode since this gets hit once a day. A single scan with a filter expression pulls items by expiry date.
Amazon Bedrock (Nova Lite,  us.amazon.nova-lite-v1:0 ) generates the recipe. I use the Converse API with adaptive retry configuration. Cross-region model ID prefix ( us. ) for higher availability.
Amazon SES sends the formatted HTML email. Running in sandbox mode, which is fine since I'm only sending to my own verified address.
IAM ties it together with two roles: one for Lambda (DynamoDB read, Bedrock invoke, SES send, CloudWatch logs) and one for the EventBridge Scheduler (Lambda invoke only).

What I Learned

Bedrock's Converse API is the right default. I initially looked at InvokeModel but the Converse API gives you a unified interface across models. If I swap Nova Lite for a different model later, I change one string.
Always set maxTokens explicitly. The Bedrock skill docs hammered this point. Leaving it unset defaults to the model's maximum and silently reserves way more quota than you need. For a recipe, 512 tokens is plenty.
Prompt personality beats prompt length. A two-sentence character description ("slightly pushy home chef who hates food waste") produced better output than a half-page of detailed instructions. The model understood tone from a minimal cue.
EventBridge Scheduler needs its own IAM role. This tripped me up briefly. The scheduler can't just invoke any Lambda. It needs a role with explicit permission to invoke your specific function. A small thing, but easy to miss if you're used to CloudWatch Events where the permission model is different.
Pre-seed your data for demos. I wrote a seed script that populates the table with items at staggered expiry dates. This means the agent produces different results each day of the weekend, which made testing more realistic and gives me multiple screenshots showing varied output.

Link to Repo

The repo includes deployment scripts, the Lambda function, seed data, and a teardown script. Clone it, set your email, run  ./deploy.sh , and you'll have a working agent in five minutes.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article