
Weekend Creative Agent Challenge: Bonfire
At night you cast whatever is keeping you awake into a bonfire, then sleep. At 3 AM, EventBridge Scheduler wakes a Lambda that calls Amazon Bedrock: it reads what you wrote, accepts it without judgment, and turns it into a short uplifting line with a matching image. By morning it waits in the gallery, transformed. Bedrock has no text-to-image model a new account can use: Nova Canvas is LEGACY and locked, Titan is EOL. The fix: hand Stability AI Inpaint an all-white mask, so it redraws the whole canvas.
Vision & What It Does
You wake up at 2 AM thinking about tomorrow's presentation and can't get back to sleep. The mistake your manager pointed out keeps replaying. Some nights are like that.
Talking to someone would help, but there is nobody to call at 2 AM. You open a journaling app, and all it does is store exactly what you typed, so reading it back in the morning makes you feel worse.
Bonfire is a place to throw that into a fire.
At night, write down whatever it is — anxiety, a complaint, frustration — and cast it in. Then just go to bed. While you sleep, the agent starts working. Amazon Bedrock reads what you wrote, accepts it without arguing with it, and turns it into a short uplifting line. It also generates an image to match the mood of that line.
In the morning, the site shows "what the fire left behind": last night's words, transformed.
Here is what it actually produced.
Input: I keep worrying about whether my presentation tomorrow will go well, and I cannot sleep. Output: Silent night will guide, a calm will come with tide.
Input: My manager pointed out a mistake I made at work and I have been feeling down about it all day. Output: A single flame's mistake, new lessons take, brighter paths unfold.
The image generated for the second one showed a flame blooming out of the firewood like a single flower. I never asked for a flower. The instruction was abstract — "a healing visual where flames turn into flowers or light" — and the model chose that composition on its own.
This is not an experience where you press a button and wait for a result. You throw something in, forget about it, and by morning it is done. The best tool really is the one you never have to open.
How You Built It
Checking the core idea first
Before writing any infrastructure, I wanted to know whether the generation part would work at all.
aws bedrock-runtime converse --region us-east-1 \ --model-id amazon.nova-lite-v1:0 \ --messages '[{"role":"user","content":[{"text":"Say hello in one short line"}]}]' \ --inference-config '{"maxTokens":50}'Nova Lite responded without any trouble. So far, so good.
None of the image models were usable
Then I moved to image generation. Nova Canvas shows up in
list-foundation-models , and its inferenceTypesSupported says ON_DEMAND , so I assumed I could just call it. Here is what came back.ResourceNotFoundException: Access denied. This Model is marked by provider as Legacyand you have not been actively using the model in the last 30 days.Please upgrade to an active model on Amazon Bedrockget-foundation-model showed status: LEGACY with legacyTime: 2026-03-30 . The model had not been removed. The restriction was that an account with no usage in the past 30 days cannot start using it. Accounts that were already using it still can. Only new adoption was closed off, which is exactly why it still appears in the list. Same result in us-east-1, ap-northeast-1, and eu-west-1.Next I looked at Titan Image Generator. Someone's published agent code used
amazon.titan-image-generator-v1 , so I figured it must work. But no image-generating Titan appeared in list-foundation-models at all. Calling it directly anyway:ResourceNotFoundException: This model version has reached the end of its life.v1 and v2 are both EOL. The code I had been looking at was written before the model was retired.
So I dumped all 121 models in us-east-1 and filtered for ones with
IMAGE in outputModalities . Fourteen matched. Thirteen of them were Stability AI — inpaint, outpaint, upscale, remove-background, style-transfer — all editing models that require an input image. The fourteenth was the LEGACY Nova Canvas.In other words, Bedrock had no text-to-image model that a new account could simply call.
Generating with an editing model
Inpaint is the kind of model you use to erase an unwanted person from a photo and fill the background naturally. Along with the source image, you pass a "mask image." The mask is black and white: white marks the region to redraw, black marks the region to keep. Normally you paint white only over the thing you want removed.
That raised a question: what happens if the mask is entirely white? Entirely white means "redraw the whole image." If the source image is discarded completely, the only thing left driving the output is the prompt. At that point, how is it different from text-to-image?
I tried Outpaint first. Feeding it a 64x64 solid-color seed and expanding in all four directions did produce a flower, but the seed's square stayed visible dead center. Maxing out
creativity didn't remove it. Outpaint is built to add around the source image, so the source is preserved by design.So I switched to Inpaint, passing a 512x512 solid-color image (anything works) and a mask with every pixel painted white (255).
const response = await bedrock.send( new InvokeModelCommand({ modelId: "us.stability.stable-image-inpaint-v1:0", contentType: "application/json", accept: "application/json", body: JSON.stringify({ image: DUMMY_BASE_IMAGE_B64, // 512x512 solid color; fully redrawn, so contents don't matter mask: FULL_WHITE_MASK_B64, // every pixel white = redraw the entire image prompt, output_format: "png", }), }));It worked as hoped: no trace of the solid-color input survived, and what came back was driven entirely by the prompt.
One aside — my first attempt used
outputFormat as the field name and was rejected. The error returns the full list of valid fields, which turned out to be the fastest way to confirm the API shape.Invalid field 'outputFormat' in request. Available fields for inpaint are:image, prompt, mask, grow_mask, negative_prompt, seed, output_format, style_presetHandling prompt injection
Users write free-form text that goes straight to an LLM, so someone can embed instructions in a post.
First, the system prompt establishes that user input is material to be purified, not an instruction. I'm keeping the exact wording private, but it states plainly that commands found inside the input are not to be followed.
On top of that, I applied Bedrock Guardrails and wrapped the user input in a
guardContent block. This scopes the filters to the user input, so the system prompt itself is not evaluated.messages: [{ role: "user", content: [{ guardContent: { text: { text } } }] }],guardrailConfig: { guardrailIdentifier: GUARDRAIL_ID, guardrailVersion: GUARDRAIL_VERSION, trace: "disabled",},Defining the Guardrail in CDK failed to deploy the first time.
PROMPT ATTACK content filter strength for response must be NONE.The PROMPT_ATTACK filter only applies to input, so its
outputStrength must be NONE . It can't be written the same way as the other filters, so I split that one out.filtersConfig: [ ...["HATE", "INSULTS", "SEXUAL", "VIOLENCE", "MISCONDUCT"].map((type) => ({ type, inputStrength: "MEDIUM", outputStrength: "MEDIUM", })), { type: "PROMPT_ATTACK", inputStrength: "MEDIUM", outputStrength: "NONE" },],AWS Services Used / Architecture Overview

Service | Role |
|---|---|
Amazon Bedrock | Nova Lite for text, Stability AI Inpaint for images, Guardrails for filtering |
AWS Lambda | Accepting posts ( post-vent ) and the nightly batch ( process-vents ) |
Amazon API Gateway | HTTP API for posting |
Amazon DynamoDB | Storing posts and results (PK: date, SK: ventId) |
Amazon EventBridge Scheduler | Triggering the nightly batch |
Amazon S3 | Static site hosting, generated images, and gallery.json |
Amazon CloudFront | HTTPS delivery |
AWS CDK (TypeScript) | Infrastructure definition |
One decision worth calling out: there is no API for reading the gallery. The nightly batch writes its results to S3 as
gallery.json , and the frontend fetches that file directly. That removes one Lambda and one API Gateway route, and drops the cost of viewing to zero. If the data only changes once a day, there is no reason to put an API in front of it.DynamoDB is a single table with the date as the partition key and the post ID as the sort key. Querying by date returns that day's posts in one call, which is all the batch and the rate-limit check need.
For abuse prevention, posts are capped at 300 characters and 10 per day. The batch has its own daily processing cap (30 by default) so the number of Bedrock calls stays bounded. The overnight gap between posting and publication also helps: nothing goes public the moment it is written.

What You Learned
Whether a model is "available" depends on your account
This was the biggest stumbling block. Nova Canvas is right there in the list, marked as on-demand. My account still couldn't call it, because the model had moved to LEGACY and the door was only open to accounts that had already been using it. Availability wasn't a property of the model — it was a property of the relationship between the model and my account.
Titan tripped me up from the opposite direction. It was in someone's working code, so I assumed it worked, but that code predated the model's retirement.
Being in the list doesn't answer the question. Neither does having seen it work in someone else's code. The only reliable check was to invoke it once from my own account.
A constraint is a reason to change the design
Once text-to-image was off the table, I tried having the model write SVG instead. Nova Lite returns syntactically valid SVG, but the coordinates don't hold together — shapes spill outside the viewport, or you get a couple of circles and nothing more. Three attempts, no stable quality, so I dropped the approach.
Asking a language model to compute coordinates is asking it to do something it is bad at. Inpaint, on the other hand, exists to draw images. Painting the mask entirely white and telling it to "redraw everything" is an unusual way to call it, but drawing is simply its job. Calling a well-suited model in an unusual way beat engineering around a poorly-suited one.
Error messages sometimes work as documentation
Bedrock's ValidationException returns the full list of valid fields when you send an invalid one. Deliberately sending one bad request was faster than searching the docs.
"Never having to open it" comes from scheduled execution alone
Nothing in this implementation runs continuously. EventBridge Scheduler invokes a Lambda once a day, and the rest of the time no resources are consumed. From the user's side, though, it feels like an agent has been working through the night. Being always-on and having a server that never stops turned out to be two different things.
Link to App or Repo
- Repository: https://github.com/sh-fk2/bonfire
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article