AWS Builder Center
Weekend Showcase Challenge: A Static Page to a Living Game

Weekend Showcase Challenge: A Static Page to a Living Game

A static AWS trivia page became a self-updating agent that writes its own mysteries, adapts its own difficulty, and now recognizes its players on a live leaderboard — built in three stages, real code and real mistakes included.

Series: Weekend Challenge - August 2026 (3 articles)

  1. 3
    Weekend Showcase Challenge: A Static Page to a Living Game This article
Cloud Data Engineer
Two weeks ago, this was a static HTML page. Ten AWS services per difficulty level, thirty clue sets I wrote by hand, hosted in an S3 bucket. Open the page, pick a level, guess the service. Nothing more happened between visits.
Today the same page opens to a mystery nobody wrote — generated overnight by an agent that decided, on its own, which AWS service to feature and how hard it should be. Solve enough of them well and it gets harder. Miss one and it eases off. And now, for the first time, the game knows who you are: sign in, play, and your best score sits on a public leaderboard next to everyone else's.
None of that happened in one leap. It happened in three distinct stages, each one small enough to actually finish, each one building on exactly what came before. This is the story of all three, told with the actual code and the actual mistakes, because the mistakes are usually where the real detail lives.



Architecture Diagram





Stage one: a static page that knows everything in advance

The first version was deliberately unambitious. Three difficulty tiers — Easy, Medium, Hard — ten AWS services in each, three clues per service, written by hand. A player picks a level, gets a clue, guesses. Wrong guess reveals the next clue. Ten rounds, then a final score out of 300.
The whole thing was one HTML file with embedded CSS and JavaScript — no build step, no framework, no server. Deploying an update meant one command:
aws s3 cp aws-service-detective.html s3://my-bucket/aws-service-detective.html
That simplicity mattered more than it might sound like it should. A static site has almost nothing that can go wrong. It was also, on purpose, finite. Thirty hand-written clue sets is an afternoon of content, not a game. Getting something working mattered more at that point than getting something unlimited — but the ceiling was obvious from day one.



Stage two: teaching the game to write its own questions

The interesting problem was always what came after: could the game generate new content forever, without me?
That question turned into an actual architecture decision, and the first one worth dwelling on: no Bedrock Agents. AWS has a managed "Agents" feature built for exactly this kind of orchestration, and it was tempting. I didn't use it. I wanted to understand — and be able to debug — every single hop a request makes, so the agent here is hand-wired from plain primitives: EventBridge Scheduler, Lambda, Bedrock, S3. Nothing delegated to a framework I couldn't step through myself.

What the agent actually does, once a day

The whole cycle is one Lambda function, triggered once daily by EventBridge Scheduler:
wake up → check recent challenges → choose a service → choose a difficulty
→ generate 3 clues (Bedrock) → validate → save the challenge → go back to sleep
Two decisions inside that loop are worth calling out specifically, because they're the kind of detail that determines whether a system like this can actually be trusted.
The model never decides which AWS service the mystery is about. That choice is made by plain Python code, drawing from a curated pool I wrote and verified myself:
SERVICE_POOL = {
"easy": ["Amazon S3", "Amazon EC2", "AWS Lambda", ...],
"medium": ["AWS CloudFormation", "Amazon SQS", ...],
"hard": ["AWS Direct Connect", "Amazon Comprehend", ...],
}
Bedrock's only job is to write three good sentences about a service the code already picked. That's a much easier thing to get right — and a much easier thing to check afterward — than trusting a model to remember the entire AWS service catalog correctly, every single day, forever.
The clues come back as structured data, not parsed text. Rather than asking the model to "please return JSON" and hoping it doesn't wrap the answer in a markdown fence, the Lambda uses Bedrock's tool-use (function-calling) feature:
response = bedrock.invoke_model(
modelId=MODEL_ID,
body=json.dumps({
"tools": [TOOL_SCHEMA],
"tool_choice": {"type": "tool", "name": "submit_mystery"},
"messages": [{"role": "user", "content": prompt}],
}),
)
The model is forced to answer through the tool interface. What comes back is already a parsed object matching the schema — no regex, no string-stripping, no surprises.

Closing the loop: difficulty that actually adapts

A scheduled generator with good taste is still just a generator. What made this feel like a genuine agent rather than a content machine on a timer was closing a feedback loop: the browser now reports whether each mystery was solved, and on which clue, back to a small API. The next day's run reads that history before picking a difficulty:
if not last.get("solved"):
return TIERS[max(0, idx - 1)] # missed all 3 clues → step down

last_three = performance_entries[-3:]
if len(last_three) == 3 and all(
e.get("solved") and e.get("cluesUsed") == 1 for e in last_three
):
return TIERS[min(len(TIERS) - 1, idx + 1)] # 3-in-a-row on clue 1 → step up
Read that in order: a single bad day overrides everything and eases off immediately. A step up requires three good days in a row, not just one lucky guess. That asymmetry was deliberate — it should be quick to protect a frustrated player, and slower to congratulate a lucky one.

What actually broke, in the order it broke

None of this deployed cleanly, and the failures are worth recording honestly rather than glossing over:
  • CloudFormation's inline code limit. The agent's code, once it had real validation and history logic, passed 4KB — the hard ceiling for inline  ZipFile  code in a template. F
  • ix: package it as a real file via  aws cloudformation package , which zips it and stages it in S3 before deploy.
  • The model-access story had quietly changed. AWS retired the old "Model Access" console page months earlier. Serverless models are auto-enabled per account/region now — except Anthropic models specifically still need a one-time use-case form, and some models are fulfilled through AWS Marketplace under the hood, needing a separate one-time subscription trigger. Three different gates, three different error messages.
  • Newer models need an inference profile, not a bare model ID.  InvokeModel  on the plain model ID failed with a  ValidationException ; it only works through a cross-region inference profile, which also meant rewriting the IAM policy to cover both the profile ARN and the underlying foundation models it might route to.
  • CloudFormation parameter defaults don't retroactively apply. Bumping a default value in the template doesn't change an already-deployed stack unless you pass that parameter explicitly on the next deploy too. Cost a confusing round of "why is it still using the old model" debugging.
  • IAM propagation lag. Correct policy, denied anyway, for about thirty seconds, because permissions hadn't finished propagating yet.
Every one of these resolved the same way: the error message was telling the truth the whole time, literally, and the fix was to read it exactly as written rather than around it.



Stage three: giving the game a memory of who's playing

The agent could write its own questions. It still couldn't recognize a person. Every play was anonymous — no record of who was good at this, no reason to come back and try to beat a previous score against someone else's.
Adding that meant a real decision, not just more code: how should players prove who they are? The lightest option was a plain nickname with no login at all — fast to build, but anyone could type any name, including someone else's, and overwrite their score. That was fine for version one. It stopped being fine the moment "leaderboard" implied something worth trusting.
So this became Amazon Cognito User Pools — the AWS-native answer to real accounts. A few specific choices shaped how it actually got built:
No SDK, no build step, no hosted UI. The whole site is still one HTML file with no framework, so account creation and sign-in call Cognito's public HTTPS API directly with plain  fetch() :
function cognitoRequest(target, body){
return fetch(COGNITO_ENDPOINT, {
method: 'POST',
headers: {
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSCognitoIdentityProviderService.' + target
},
body: JSON.stringify(body)
});
}
Cognito's public app-client actions —  SignUp ,  InitiateAuth  — are designed to be called this way, directly from a browser, with no backend proxy and no signing required.
New accounts skip email verification, on purpose, with the trade-off stated plainly. A tiny Lambda trigger auto-confirms every sign-up:
def handler(event, context):
event['response']['autoConfirmUser'] = True
event['response']['autoVerifyEmail'] = True
return event
That removes an entire UI flow — no "check your inbox for a code" screen to build. It also means email addresses on this system are not actually verified. Acceptable for a game leaderboard. Not a pattern to reuse anywhere that needs real identity assurance.
The leaderboard trusts the token, never the request body. Before accounts existed, a score submission just included whatever nickname the client typed — spoofable by definition. Now,  POST /score  sits behind an API Gateway JWT authorizer, which validates the token's signature, issuer, and audience before the Lambda ever runs. The Lambda reads the player's identity from the verified claims, not from anything the browser sent:
claims = event["requestContext"]["authorizer"]["jwt"]["claims"]
user_id = claims.get("sub")
nickname = claims.get("nickname") or claims.get("email", "").split("@")[0]
Nobody can submit a score under someone else's name anymore, because the identity isn't a form field. It's a cryptographically verified fact by the time the code sees it.
The public leaderboard read stays open. Only  POST /score  needs a real account —  GET /leaderboard  has no authorizer attached at all. Spectators can see the top five without signing up for anything.

The detail that actually broke it

Adding the  Authorization  header to score submissions introduced a bug that took several rounds of debugging to actually see: the API's CORS configuration allowed  Content-Type  as a header, but not  Authorization . The moment the frontend started sending a bearer token, every browser's preflight  OPTIONS  check failed silently with a CORS error — because the header itself, not just the request, needs to be explicitly allowed:
CorsConfiguration:
AllowHeaders: ['Content-Type', 'Authorization'] # the second one was missing
One missing string in a list. It's the kind of thing that's invisible until the exact moment a new feature needs it, and then it's the only thing standing between "works" and "blocked by browser security policy" — with an error message that, unhelpfully, looks identical to a dozen other CORS misconfigurations.
A second, unrelated deploy failure showed up in the same session: CloudFormation's newer early-validation feature rejected the raw template outright, because the  Code: lambda_function.py  property is only ever valid after  aws cloudformation package  rewrites it into a real S3 reference — deploying the unpackaged template directly, even for what looked like a config-only change, fails validation immediately. The fix was procedural, not technical: package before every deploy, without exception, regardless of what actually changed.



What the system looks like n

Four independent pieces, connected only through S3 and two small APIs:
  1. Generation — EventBridge wakes the agent once a day; it checks recent history, picks a service and difficulty, asks Bedrock for clues, validates them, and saves the result.
  1. Play and feedback — the static site reads today's mystery from S3; when it ends, the browser reports the outcome back, which shapes tomorrow's difficulty.
  1. Accounts and leaderboard — Cognito handles real identity; a JWT-protected endpoint accepts scores under a verified identity; DynamoDB holds each player's best score; a public endpoint serves the top five.
  1. Alerting — a CloudWatch alarm watches for agent failures and emails a notification if the daily run ever breaks.
Nothing runs when nobody's playing and nothing's scheduled. The only always-on cost is what genuinely needs to be always-on: none of it.



What two weeks actually changed

The game looks almost the same as it did on day one — same clue-and-guess mechanic, same detective framing. What changed is everything underneath the surface a player never directly sees, and what it adds up to is a system that behaves less like a static page and more like something with a memory: it remembers what it asked yesterday, it remembers how well you did, and now it remembers you specifically.
The build order mattered as much as the destination did. Static first, because you can't debug an agent's mistakes if you're also debugging your first S3 deploy at the same time. Generation before adaptation, because a feedback loop needs something to adapt to. Accounts last, because a leaderboard without accounts is just a list of names anyone can claim — and a leaderboard is only worth building once there's an identity worth trusting behind each entry.
The final page looks like this.

Two weekends, one static page, one self-updating agent, and now, finally, a reason to come back and see if you're still on top.

Series: Weekend Challenge - August 2026 (3 articles)

  1. 3
    Weekend Showcase Challenge: A Static Page to a Living Game This article
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