AWS Builder Center

I Built an App That Writes a Poem Every Day Without Me

DailySpark is a scheduled AI agent on AWS that picks its own theme and writes an original poem every morning, before anyone opens the site. No button, no prompt, no human in the loop. Here is how I built it with EventBridge, Lambda, Bedrock, and DynamoDB, and the two things that broke along the way.

I Built an App That Writes a Poem Every Day Without Me

Most AI demos wait for you. You open a page, you type something, you press a button, and the model answers. I wanted the opposite. I wanted something that had already done its work before I arrived.
So I built DailySpark. It writes one original poem every day. Nobody asks it to. There is no button anywhere in the app. By the time you open the website, the poem is already sitting there, written hours ago, filed away, waiting.


The idea

A creative app should be allowed to create on its own. That was the whole thought.
DailySpark is a small agent that wakes up once a day. It looks at what it has already written recently, decides what it wants to write about next, writes a poem, checks that the poem is actually usable, and saves it. Then it goes back to sleep. The website is just a quiet room where you can read whatever it made.
The important part is that the poem exists whether or not anyone visits. That is what separates this from a chatbot with a nice font.

How it decides what to write about

I did not want to hand the model a fixed list and let it cycle through. That would feel mechanical after a week.
Instead the agent builds its own pool of ideas from three sources. It looks at the season, so August gives it heat and long light while January gives it frost and early dark. It looks at the day of the week, so Monday leans toward beginnings and Friday leans toward release. And it mixes in a set of open ended subjects like old maps or a kitchen at midnight.
Then it reads the last ten poems from the database and throws out anything it has already used. Whatever is left, it picks from. So the poems drift naturally through the year and never circle the same idea twice in a week.
When I ran it for the first time, the log line read: theme selected, a kitchen at midnight. Nobody chose that. It did.


How it is built

Nine AWS services, all defined as code in one template file.
Amazon EventBridge holds the schedule. Once a day it fires and triggers a Lambda function. That Lambda is the agent. It reads the recent poems from Amazon DynamoDB, picks its theme, and calls Amazon Bedrock to write the poem. If Bedrock returns something usable, the poem goes into DynamoDB. If not, nothing is saved at all.
On the reading side, a second Lambda sits behind Amazon API Gateway and does one thing: return today's poem and the last seven. A static website on Amazon S3 fetches that and displays it. The website can only read. There is no route anywhere that can trigger generation, which means even if someone found the API, they could not make it write.




Services used

Service
What it does here
Amazon EventBridge
Fires the daily schedule. The only thing that starts a generation.
AWS Lambda
Two functions. One writes the poem, one serves it.
Amazon Bedrock
Writes the poem. I used Amazon Nova Micro, the cheapest option.
Amazon DynamoDB
Stores the archive. One item per day.
Amazon API Gateway
A single public route that can only read.
Amazon S3
Hosts the website.
AWS IAM
Separate permissions for each function.
Amazon CloudWatch
Logs, so I can see what the agent decided.
AWS SAM
The whole stack as one template file.





The part I am most happy with

The agent refuses to save bad work.
Language models sometimes return an apology instead of a poem, or wrap their answer in extra formatting, or produce two lines and stop. If I saved whatever came back, the website would eventually show something broken, and a broken poem on a poetry site is worse than no poem.
So the response goes through a checker before it is stored. It has to be valid JSON. It has to have a real title. It has to have a body of at least four lines. If any of that fails, the error gets logged clearly and nothing is written. An empty day is better than an embarrassing one.
I wrote fifteen tests for this logic, and none of them need AWS to run. The theme picker is deterministic, meaning the same date and the same archive always produce the same choice, which is exactly what makes it testable without pretending to be a language model.

Two things that went wrong

The first deploy failed and rolled back. The error said the schedule expression was not valid, which was confusing because the expression was correct. It turned out the deploy tool splits its parameters on spaces, and my schedule contained spaces, so it arrived cut in half. Wrapping the value in quotes fixed it.
The second problem was that my AWS account was brand new. Bedrock told me the account was still being verified, and later that I had used too many tokens for the day, on an account that had generated nothing at all. Both are new account limits and they clear on their own. Everything else deployed fine while I waited, which was lucky, because it meant I could stand the whole system up and simply fill in the poem afterward.
If you are building on a fresh AWS account this weekend, budget time for that. It is not your code.

What it costs

Almost nothing. One Bedrock call a day on the cheapest model is a fraction of a cent. DynamoDB stores one small item per day. Lambda runs about thirty one times a month. The whole thing sits inside or near the free tier, and I wrote a cleanup script that deletes every resource in one command so it cannot quietly keep charging me.

What I would do next

Let the poems talk to each other. Right now the agent avoids repeating a theme, but it does not know what it actually wrote. I would like it to read its own previous poem and occasionally answer it, so that over a month the archive reads less like a list and more like a mind changing its position.
I would also like to give it a bad mood now and then.

Try it

The code is on GitHub with a full README, an architecture diagram, deployment commands, and a troubleshooting section covering every error I hit.
You can deploy your own in about ten minutes with one script, assuming your AWS account is older than mine was.
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