AWS Builder Center
Weekend Creative Challenge: Verse Weaver

Weekend Creative Challenge: Verse Weaver

An AI poem loom built on Bedrock, Lambda, and a weekend's worth of curiosity.

Cloud Engineer - AWS

Vision & What The App Does

Verse Weaver takes one thing from you: a theme, a mood, a fragment of an idea like "rain on a tin roof" or "a robot's first birthday." You pick a poetic form (haiku, sonnet, free verse, or limerick), and Amazon Bedrock's Nova Lite model writes an original poem on the spot. Every poem gets saved to a public gallery, so the app slowly becomes a shared, growing collection of AI-generated verses from anyone who visits.
The creative output here is the poem itself, not a generic text completion. I leaned into that by giving the interface an ink-and-typewriter identity: a dark study, a cream paper card, a maroon wax-stamp accent, and a typewriter-style reveal animation so the poem appears to be typed in front of you rather than just dumped on screen.



How I Built It

I gave myself one constraint going in: keep the architecture boring on purpose. A weekend challenge is not the place to be clever with infrastructure. It is the place to be clever with the creative idea and let the infrastructure be the part you have done a hundred times.
Step 1: Design the shape of the request first. Before writing a line of Lambda code, I decided exactly what the frontend would send and what it would get back. One  POST /generate  with a  theme  and  style , one  GET /gallery  to pull recent poems. Deciding the contract first meant the Lambda function, the DynamoDB schema, and the frontend fetch calls could all be built in parallel without me having to backtrack.
Step 2: Call Bedrock the simple way. My first instinct was to reach for the raw  invoke_model  API and hand-build the request body for Nova's expected format. Then I found the  converse  method on the Bedrock Runtime client, which normalizes the message format across models. That one decision saved me from having to hardcode Nova-specific JSON shapes:
The prompt itself is short on purpose. I ask for the chosen style, cap it at 12 lines, and explicitly tell the model to return only the poem with no title and no preamble. Without that last instruction, Nova kept adding a friendly "Here's your poem:" line before the actual verse, which broke the typewriter animation on the frontend.
Step 3: One Lambda, two routes. Instead of two separate functions, I routed both  /generate  and  /gallery  through a single Lambda based on the HTTP method and path. It is a small decision, but it meant one IAM role, one deployment package, and one place to look when something breaks:
Step 4: Terraform the whole thing. Since I already work with Terraform daily, I wired up the entire stack as IaC (infrastructure as code, meaning the whole environment is defined in files instead of clicked together in the console) rather than clicking through the AWS console.  terraform apply  provisions the DynamoDB table, the Lambda function, the HTTP API Gateway routes, and an S3 bucket with static website hosting enabled, all in one pass.
The challenge I hit: the frontend needed to know the API's URL, but that URL does not exist until Terraform creates the API Gateway stage. I could not just upload a static  index.html  with a hardcoded endpoint. The fix was a placeholder string,  __API_URL__ , baked into the HTML, which Terraform swaps for the real endpoint at deploy time using its  replace()  function right before uploading the file to S3:
That single  replace()  call meant I did not need a separate build step, a config file, or any client-side environment variable trick. One  terraform apply  and the frontend is wired to the live backend automatically.
AWS Services Used / Architecture Overview




Service
Role
Amazon Bedrock (Nova Lite)
Generates the poem text from the theme and style
AWS Lambda
Handles both  /generate  and  /gallery  requests
Amazon API Gateway (HTTP API)
Public HTTPS entry point, routes requests to Lambda
Amazon DynamoDB
Stores every generated poem for the public gallery
Amazon S3
Hosts the static frontend as a public website
Request flow:
Browser (S3 static site)
|
v
API Gateway (HTTP API)
|
v
Lambda (Python)
| |
v v
Bedrock DynamoDB
(Nova Lite) (poem gallery)
Everything here is serverless. There is no server to patch, no idle compute racking up cost between poems, and the whole stack fits comfortably inside AWS Free Tier and new-account credits.

What I Learned

The biggest surprise was how much prompt phrasing affects output structure, not just content. Telling Nova to write "under 12 lines" produced wildly different lengths until I added "return only the poem text, with no title, no preamble." Small instruction, big difference in how usable the raw output was.
I also had not used  bedrock.converse()  before this project. Coming from the AWS ecosystem, I expected foundation model APIs to be as fiddly as some other AWS service payloads. The Converse API's normalized message format was a genuinely pleasant surprise, and it is now my default entry point for any Bedrock project going forward.
Terraform's  replace()  function for injecting a runtime value into a static file was a small trick I had not needed before. It is a pattern I will reuse anywhere a static frontend needs to know about infrastructure that only exists after  apply  runs.

Honest Trade-Offs

I want to be upfront about the corners I cut, since a weekend challenge is exactly the place to make deliberate trade-offs instead of hiding them.
The gallery endpoint uses a DynamoDB  scan  instead of a query against a global secondary index on  createdAt . A scan reads every item in the table, which is fine at hackathon scale but would get expensive and slow as the table grows. The fix is a GSI keyed on a constant partition value with  createdAt  as the sort key, which I would add before this went anywhere near production traffic.
The S3 site is served over plain  http:// , not  https:// , since static website hosting on S3 does not support TLS directly. A CloudFront distribution in front of the bucket would fix that along with giving the site a proper domain, but it was outside this weekend's scope.
There is no rate limiting or abuse protection on  /generate . Anyone with the API URL can call it directly and rack up Bedrock usage. For a weekend demo this is an acceptable risk, but I would add API Gateway throttling or a simple per-IP limit before sharing this more widely.

Try It Yourself

Source code:  https://github.com/TanseerS/verse-weaver&#xA ;





YouTube :  https://youtu.be/aa1Hs4HyWFI 

The full source includes the Terraform for the entire stack, the Lambda function, and the frontend, so you can deploy your own copy with  terraform apply  after enabling Bedrock model access for Nova Lite in your account.

Quick Checklist Before You Go Live

  • [ ] Bedrock model access requested and approved for Nova Lite, in the same region you deploy to
  • [ ]  terraform apply  completed with no errors
  • [ ]  /generate  tested directly with  curl  before touching the UI
  • [ ]  /gallery  returns poems after at least one successful generation
  • [ ] S3 website URL loads and the gallery populates on refresh

Conclusion

The poem generator itself is a small, forgettable piece of software. Nobody is going to remember the exact haiku it wrote them next week. What I will carry forward from this weekend is the pattern: keep the infrastructure boring, keep the creative idea sharp, and let a single Terraform apply carry the whole stack from nothing to a live URL. That pattern outlives any one poem.

Need Help?

If you run into trouble with the Bedrock model access step, the CORS configuration, or the Terraform  replace()  trick, feel free to reach out. I am happy to walk you through it.
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