AWS Builder Center
Gobble Royale: I Cooked Up a $5 Thanksgiving Game, Then Ran It Like a Production Service

Gobble Royale: I Cooked Up a $5 Thanksgiving Game, Then Ran It Like a Production Service

Every turkey online. One field. The Chef is coming.

Cloud Infrastructure Engineer

This year I'm grateful for this community: the people who answer questions at midnight, share what they've learned and make building on AWS more fun.
To say thanks, I made something for all of us to play: Gobble Royale, a live multiplayer turkey battle royale. Everyone online is a turkey on one field, the Chef is coming and the oven is closing in. Be the last turkey standing and win it for your state (or country)!

Pull up a chair



Play now
 gobble.98-88-244-8.sslip.io 
(on a phone, turn it sideways)
Is the oven hot?
 gobble.98-88-244-8.sslip.io/status 
(watch it measure you while you play)
The recipe book
 github.com/Rajpreet12/gobble-royale 

Behind the fun, it's run like a production service: SLOs, an error budget, burn-rate alerts and a CI/CD pipeline, all on one $5 server.
Grab a plate, bring a friend, and let's see which state rules the roost. Happy Thanksgiving to you and your families!




What's on the table today

Course
What you'll learn
Appetizer
Why one $5 server beats a $35 setup for a real-time game
Main course
p50, p95 and p99 explained, and the bug that made the game run 20% slow
Side dish
SLOs and an error budget you can defend: why 99.5% and not 99.9%
From the oven
Alerts that wake you only for real outages: burn rate, page vs ticket
Kitchen fire drill
The game day: I broke production on purpose, paged in 4.5 minutes
Farm to table
A CI/CD pipeline where the error budget decides whether you can deploy
Dessert
What a real player broke, and 20 errors I hit, with their fixes
Grab a plate. Let's eat

My Halloween project, The Haunted House of AWS, went viral. For Thanksgiving I wanted something completely different: no AI writing stories, no voice. A real-time multiplayer game where strangers play together.

So I built  Gobble Royale : every turkey online on one shared field, a Chef who hunts the nearest bird, and an oven that closes in. Last turkey standing wins it for their state.

Then I did something most side projects skip. I ran it like a production service, the way a DevProd or SRE team would: SLOs with p95 and p99 latency, an error budget, burn-rate alerts, a game day where I broke production on purpose, blameless postmortems, and a CI/CD pipeline that blocks slow code and rolls back by itself.

It all runs on one $5 a month server. This post is what I built, what broke, and what each failure taught me. Every number in it is real.

What you'll learn:
  • What p50, p95 and p99 mean, and why an average lies
  • How to set an SLO and an error budget you can actually defend
  • How to alert so you get woken up for real outages and nothing else
  • How to run a game day and write a postmortem
  • How to build a deploy pipeline that uses your error budget as a gate




The game, and why it costs $5

The server decides everything; browsers only send a direction. That one rule shaped the whole design. A player can't teleport out of trouble, because their page never tells the server where they are, only which way they want to go.

Each arena runs 30 ticks a second and sends 15 snapshots. Bots fill the field to 10 turkeys, so the first visitor never plays alone. Your own turkey moves the instant you press a key and is gently pulled toward the server's position; everyone else is drawn 110 ms in the past and blended between snapshots, so they glide instead of jumping.



The server only plays the game. Checking, alerting and deploying all run outside it, so a dead server can still be noticed and fixed.

Why not a serverless WebSocket service? Pay-per-message pricing is about $1 per million messages delivered. 500 players at 15 updates a second is about 27,000 messages a second, roughly $97 an hour. One server costs the same whether 5 or 500 people play.

Why not containers? My first deploy used ECS Express Mode: one Fargate task behind a load balancer, with HTTPS out of the box. It worked, and it cost about $35 a month before data transfer. Most of that was the load balancer. So I moved to a single Lightsail server with Caddy in front for free HTTPS:

ECS Express Mode
Lightsail
Monthly cost
about $35 + data out
$5
Data transfer
about $0.09 per GB
1 TB included
HTTPS
the load balancer
Caddy + Let's Encrypt, free
Scales to
1 to 3 tasks
one server (about 600 players in my load test)
The domain comes from sslip.io, a free DNS service that maps  gobble.98-88-244-8.sslip.io  to the server's IP, so Let's Encrypt can issue a certificate without buying a domain. The full stack, including everything in the rest of this post, costs about $5.35 a month.



Phase 1: measure what players feel

My first load test failed and it found a bug that made the whole game run 20% slow.
First, the vocabulary. Sort every measurement from fastest to slowest. p50 is the middle one. p95 is 95% of the way along: only 1 in 20 was slower. p99 means only 1 in 100 was slower. An average hides the slow tail: 99 ticks at 1 ms and one at 200 ms average about 3 ms, which looks healthy, but every player felt that 200 ms freeze.
The server records four indicators (SLIs), each with a target (SLO):
SLI
SLO
Why this percentile
Game tick time
p99 under 10 ms
The loop is shared: one slow tick hurts everyone at once
Tick lateness (stutter)
p99 under 15 ms
Late ticks mean late snapshots
Player round trip
p95 under 250 ms
Mostly the player's own network, so a few bad Wi-Fi connections shouldn't decide service health
Page response
p95 under 50 ms
A slow first load loses players before they join
Each latency is recorded twice: as a Prometheus histogram at  /metrics  for monitoring tools, and as a 5-minute window of raw samples that gives exact percentiles for the live  /status  page. Route labels come from a fixed list, never the raw URL, so nobody can create a new metric series per request and exhaust memory (a cardinality explosion).




The bug. The load test showed snapshots arriving every 81.8 ms instead of 66.7. The loop used  setInterval , which assumes every tick fires on time. Every late wake-up delayed that tick and every tick after it, so game time fell behind real time. The fix was a fixed-timestep loop: each tick has a deadline, a late wake-up runs the ticks it missed (up to three), and a hopeless delay resyncs.

Run
Snapshot gap p50 (target 66.7 ms)
Tick lateness p99
Original loop, Windows laptop
81.8 ms
15.3 ms
Fixed loop, Windows laptop
66.3 ms
15.4 ms
Fixed loop, Lightsail (Linux)
66.7 ms
1.4 ms
The remaining 15 ms on the laptop was the Windows timer, which wakes about every 15.6 ms. The same code on Linux was 1.4 ms. Lesson: measure on the hardware you actually run on.

Phase 2: an SLO you can defend, measured from outside

The availability SLO is 99.5% of minutes over 30 days, which allows 216 minutes of downtime a month. That number is the error budget.
Check from outside. If the server dies, anything running on it dies too and can't report the outage. So the uptime check is a Lambda function that runs every minute, does what a player's browser does (load  /health , then open the game WebSocket), and records good and bad minutes in DynamoDB. A check that fails is retried once after 2 seconds, so a single dropped packet doesn't spend budget.
Why 99.5% and not 99.9%? 99.9% allows only 43 minutes a month. One $5 server can't promise that: a reboot for security updates, a deploy and a Lightsail maintenance event each cost minutes. Getting to 99.9% would need a second server and a load balancer, about $35 a month. The SLO should match what the architecture can honestly deliver.





Burn rate is how fast the budget is going. 1x means on pace to use exactly all 216 minutes in 30 days. 14.4x sustained for an hour burns 2% of the month in that hour and empties the budget in about 2 days.
The budget is there to be spent. The written policy says what happens at each level:
Budget left
What we do
More than 50%
Ship freely
25 to 50%
Deploy in quiet hours, with a rollback ready
Under 25%
No new features, reliability fixes only
Used up
Feature freeze until the 30-day window recovers
Thanksgiving week (Nov 23 to 29) is a freeze no matter what the budget says. The checker costs about $0.15 a month, and its known blind spot is written down too: it runs in the same AWS region as the server, so it can't see problems between a player's internet provider and AWS.

Phase 3: alerts that wake you for real outages only

A single failed check never pages anyone; a real outage pages within 5 minutes. Two ideas from Google's SRE workbook make that work.
Page vs ticket. A page means act now, even at 3 AM. A ticket means look tomorrow. Waking people for things that can wait trains them to ignore alerts.
Multi-window burn rate. Each alert needs a long window and a short one to agree. The long window stops one blip from firing; the short window means the alert clears minutes after the problem does, instead of staying red for an hour.
Alert
Fires when
Clears when
[PAGE] Players can't reach the game
Burn rate at least 14.4x over 1 hour and over the last 5 minutes
5 clean minutes
[TICKET] Slowly burning the budget
At least 6x over 6 hours and over the last 30 minutes
30 clean minutes
[TICKET] The game feels slow
A latency SLO missed for 10 checks in a row
3 good checks in a row
[TICKET] The checker itself stopped or is failing
CloudWatch alarms on the Lambda
It's healthy again
Inhibition. While designing this I noticed a big outage would also trip the slow-burn rule, sending four emails for one problem: page, page resolved, ticket, ticket resolved. Now a ticket that starts while the page is firing is marked as part of the same outage and stays quiet. One outage, two emails.



Who watches the watcher? If the checker breaks, no outage alert could ever fire. Two CloudWatch alarms watch the checker from outside and email the same topic.
Alert rules are code, so they get tests. The rules live in a module with no AWS calls in it, and six tests replay fake outages minute by minute: one blip stays silent, a 15-minute outage pages at minute 5 with exactly two emails, a long outage reminds hourly, a slow leak opens a ticket and never pages. One small catch: SNS email subjects must be plain ASCII, so the tags are words, not emoji.



Phase 4: break production on purpose

A planned 5-minute outage paged in 4 minutes 29 seconds and was fixed 48 seconds after the page, using the runbook. It also found two things that were quietly broken.
A game day is a controlled experiment. Before touching anything I wrote down the hypotheses, the blast radius (about 8 minutes of downtime), the budget cost (about 4%, which the policy allows) and the abort rule. The go/no-go check: 0 players online and the budget at 100%.



Experiment 1: a hard crash.  kill -9  on the game process. systemd restarted it in 2.4 seconds. No bad minute was recorded and nobody was paged, which is exactly right for something that fixes itself.

Experiment 2: a real outage.  systemctl stop gobble , and the game stays down.
Time (UTC)
What happened
16:46:59
Game stopped. Outage begins.
16:47:27
First bad minute recorded: detected in 28 s
16:51:28
[PAGE] sent at the 5th bad minute, exactly as the unit test predicted
16:52:03
Responder runs the runbook checks: the game service is inactive
16:52:16
 systemctl restart gobble . Game back. Outage: 5 min 17 s.
16:57:26
[RESOLVED] sent after 5 clean minutes. Two emails total.

What it found:
  1. The status page shared fate with the game. It's served by the game server, so during the outage it was a 502, and the alert email's first step pointed the responder at a dead page. Alerts now link to the error budget page, which runs in Lambda and stays up.
  1. Players saw a blank 502. Caddy now serves a "The farm is restarting" page that retries every 10 seconds, still returning 503 so the checker sees the truth. The first version of that config used syntax only Caddy 2.7+ understands;  caddy validate  caught it before it reached production, which runs 2.6.2.

I wrote a blameless postmortem for it, and one for a real incident from the week before: the first Lightsail boot silently did nothing, because Lightsail runs launch scripts with  sh , and one bash-only line ( set -o pipefail ) stopped the script on line one. "Machine running" is not "game working".

Phase 5: a pipeline that enforces the SLOs

A change now goes from  git push  to production in about 94 seconds, and a change that makes the game slower can't get there at all.








Three things can stop a change: a red CI run, a deploy gate that says no (low budget or a freeze), and a failed smoke test, which also sends production straight back to the previous version.
CI runs on every push and pull request. Every check exists because something went wrong without it:
  • Unit tests for the game rules, the metrics and the alert rules (simulated outages)
  • ShellCheck on the Lightsail setup script as plain sh:  sh -n  misses the  pipefail  bug from the postmortem, ShellCheck reports it as SC3040
  • The Caddyfile validated with Caddy 2.6.2, the exact version production runs
  • A load test as an SLO gate: 60 fake players for 30 seconds; any missed SLO turns the build red

The deploy runs only after green CI on  main . It skips docs-only changes, then runs a gate that turns the error budget policy into code: blocked under 25% budget, blocked during the Thanksgiving freeze, blocked if the budget can't be read. An "emergency" override exists, with a required reason, because a gate with no override gets deleted the first time it blocks an urgent fix.
The bundle carries a  VERSION  file with the git commit, and  /health  reports it. The smoke test waits until production reports the new commit, then checks the pages and the game connection. If anything fails, the previous version is swapped back in automatically.
Credentials come from GitHub OIDC: no AWS keys are stored in GitHub, and each run gets credentials that last at most an hour. The role can do five Lightsail actions on one server and nothing else.

What the first runs taught me:
  1. CI failed on code that passed on my laptop. The runner's older ShellCheck reports one warning under a different code. Fix: pin tool versions so CI and laptops agree.
  1. AWS refused GitHub's token. CloudTrail showed GitHub now names the repo with permanent numeric IDs ( owner@id/repo@id ). That's more secure: if the repo were deleted, someone re-creating it under the same name can't inherit the access.
  1. A real security hole. The deploy ran on  workflow_run  filtered by branch name. Anyone could fork the public repo, name a branch  main  and open a pull request, and the deploy would run their script with my AWS role. Now it only runs for pushes to this repository. This class of bug is called a pwn request.

What a real player broke

The first real player found a bug none of my tests had: a deploy kicked them out, and their screen kept pretending they were still playing.
A friend was playing when I shipped a change. The deploy restarted the server, which closed every connection. Their page didn't notice the connection had died, and because their own turkey is predicted locally for smoothness, it kept moving on screen. To them the game looked alive. To the server, nobody was online.
Three fixes came out of it:
  1. Auto-reconnect. Snapshots arrive 15 times a second, so 3 seconds of silence means the connection is gone. The page shows "Reconnecting..." and rejoins by itself, waiting 1, 2, 4 seconds and so on with random jitter, so hundreds of players don't hit a restarting server in the same instant (the thundering herd problem). In a test, a player was back in the lobby 0.5 seconds after the server returned. A deploy is now a 2 to 3 second blip.
  1. Metrics survive restarts. Every deploy used to wipe the status page's last 5 minutes and its hour of charts. They're now saved every minute and on shutdown, and restored on start. Across the next deploy: 31 samples before, 31 after.
  1. No verdict from too few samples. Right after a restart, one slow first page load (119 ms) marked the page SLO as missed, from a single sample. An SLO now needs 20 samples before it's judged either way.


Troubleshooting: every error I hit, and the fix

These are the real errors from building this, word for word, so you can search for yours. Each one cost me between two minutes and an hour.

Lightsail

The server booted, but nothing answers on port 80 or 443. The launch script stopped on its first line:  set: Illegal option -o pipefail  in  /var/log/cloud-init-output.log .
  • Cause: Lightsail adds its own lines to the top of your launch script, so your  #!/bin/bash  line is no longer first and the script runs under  /bin/sh  (dash on Ubuntu), which rejects bash-only syntax.
  • Fix: write the launch script in plain sh ( set -eux , no  pipefail , no  [[ ]] ). Check it with  shellcheck -s sh , which reports SC3040.  sh -n  does not catch it.
The launch script ran but the download failed.
  • Cause: it fetched the code from an S3 presigned URL, and a presigned URL from a temporary session lasts at most 15 minutes. Debugging took longer than that.
  • Fix: generate a fresh URL just before rerunning. For a launch script, keep the setup safe to run twice.
 Permission denied (publickey)  partway through a session.
  • Cause: the SSH certificate from  aws lightsail get-instance-access-details  is short-lived.
  • Fix: call it again for a fresh key and certificate. For incidents, use Connect using SSH in the Lightsail console, which has no expiry problem.

Caddy

 Error during parsing: unrecognized directive: <!doctype  from  caddy validate .
  • Cause: I used a  <<HTML  heredoc inside the Caddyfile. Heredocs need Caddy 2.7+, and Ubuntu 24.04's package is 2.6.2.
  • Fix: quote the response body with backticks instead. Always run  caddy validate  before  systemctl reload caddy , and validate in CI with the same Caddy version production runs.

ECS Express Mode

 Unable to assume the service linked role. Please verify that the ECS service linked role exists. 
  • Cause: the account had never used ECS, so the  AWSServiceRoleForECS  role was being created at that moment and hadn't propagated.
  • Fix: wait about 20 seconds and retry. If it persists, create it with  aws iam create-service-linked-role --aws-service-name ecs.amazonaws.com  (an "already taken" error means it exists).
The new  https://….ecs.us-east-1.on.aws  URL says  Non-existent domain , but ECS reports the service healthy.
  • Cause: I checked the URL before it existed, and my internet provider's DNS cached the "doesn't exist" answer.
  • Fix: check with a public resolver ( nslookup <host> 8.8.8.8 ) and wait a few minutes for your provider's cache to expire.


 Authentication Mode 

 Could not assume role with OIDC: Not authorized to perform sts:AssumeRoleWithWebIdentity 
  • Cause: the role's trust policy expected  repo:owner/repo:ref:refs/heads/main , but GitHub's token named the repo with permanent numeric IDs.
  • Fix: look up the failed  AssumeRoleWithWebIdentity  event in CloudTrail; it shows the exact subject GitHub sent, in my case  repo:Rajpreet12@147854707/gobble-royale@1443637910:ref:refs/heads/main . Trust that. It's also safer: a repo re-created under the same name can't inherit the access.
I changed a parameter's default, redeployed, and nothing changed.
  • Cause:  aws cloudformation deploy  keeps a stack's previous parameter values, even when the template's default changes.
  • Fix: pass the new value with  --parameter-overrides .
CI fails on a script that passes ShellCheck on my laptop.
  • Cause: the runner's preinstalled ShellCheck is older and reports some checks under different codes.
  • Fix: pin tool versions in CI ( pip install shellcheck-py==0.11.0.1 cfn-lint==1.52.1 ) so CI and laptops agree.
Anyone could trigger my deploy. Not an error message, but the worst bug in the project.
  • Cause: a  workflow_run  deploy filtered only by branch name runs for CI on fork pull requests too, and a fork's branch can be named  main .
  • Fix: also require  github.event.workflow_run.event == 'push'  and  github.event.workflow_run.head_repository.full_name == github.repository .

The game itself

The game runs about 20% slow under load.
  • Cause: a  setInterval  game loop never catches up after a late wake-up, so game time falls behind real time.
  • Fix: a fixed-timestep loop with deadlines that runs missed ticks (up to a few) and resyncs after a long stall.
A player looks like they're playing, but the server shows 0 players online.
  • Cause: a deploy closed the connection, but the page didn't notice; local prediction kept their turkey moving.
  • Fix: treat 3 seconds without a snapshot as a lost connection, then reconnect with exponential backoff and jitter.
The status page goes down exactly when you need it.
  • Cause: it was served by the same server as the game.
  • Fix: point alert emails at a page hosted elsewhere (here, the error budget in Lambda). Long term, host the status page outside the service.

Developing on Windows

 Segmentation fault  from  ssh  in Git Bash when using a Lightsail certificate.
  • Fix: use Windows' own client,  C:\Windows\System32\OpenSSH\ssh.exe . It also requires the key file to be readable only by you ( icacls key /inheritance:r /grant:r "%USERNAME%:(R)" ).
AWS CLI says  logGroupNamePrefix failed to satisfy constraint  for  /aws/lambda/... .
  • Cause: Git Bash rewrites arguments that start with  /  into Windows paths.
  • Fix: run  export MSYS_NO_PATHCONV=1  first.
Shell scripts fail on Linux with  $'\r': command not found .
  • Cause: Git on Windows converts line endings to CRLF on checkout.
  • Fix: add a  .gitattributes  with  * text=auto eol=lf .
Tick lateness of about 15 ms on a laptop, 1.4 ms on the server. Not a bug: Windows wakes timers about every 15.6 ms. Measure on the machine you deploy to.

What I'd tell anyone running a side project

The practices that big teams use are cheap to adopt at small scale, and every one of them caught something real here.
  1. Measure percentiles, not averages. My "1.14 ms per tick" was an average; the p99 told the real story.
  1. Measure on the hardware you run on. The Windows timer made a healthy loop look broken.
  1. Check from outside. A server can't report its own death, and "machine running" is not "game working".
  1. Set the SLO the architecture can keep. 99.5% on one $5 server is honest; 99.9% would have been a lie.
  1. Alert on burn rate, test the alert rules. The game day page arrived at the exact minute the unit test predicted.
  1. Break it on purpose. The game day found a status page that died with the service, which I'd never have noticed otherwise.
  1. Let the pipeline enforce the policy. A load test that blocks slow code and an error budget that blocks risky deploys beat any checklist.
  1. Pin your tools. CI and laptops disagreed until versions were pinned, for ShellCheck and for Caddy.
  1. Real users find what tests don't. One friend found the reconnect bug in minutes

Happy Thanksgiving to you and your families, from my kitchen to yours.
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