
Weekend Showcase Challenge: AWS Real-Time Subtitles
Live English talks, read in Portuguese. Built for community events in the north of Brazil, where the best speaker in the room is often the one half the audience can't follow. Transcribe + Translate, no login for the audience, ~$0 idle.
I live in Belém, in the north of Brazil. Our tech community here is growing and very much alive, but it has one recurring problem that no amount of enthusiasm fixes.
We get great international speakers. We also have a room full of people who do not speak English. So the best talk of the day lands on maybe a third of the audience, and everyone else politely waits it out. It is not a comprehension problem, it is an access problem: cutting-edge knowledge arrives in a language the people who most need it cannot follow.
I saw this happen over and over at events organized by so many great people. The language barrier was the one thing that kept partially undoing that work, event after event.
Commercial live-captioning services exist. They charge per seat, require accounts for the audience, and expect planning weeks ahead. Community events do not work that way. We decide on Thursday and present on Saturday, on somebody's personal AWS account.
AWS Real-Time Subtitles is my answer: the speaker opens a link, clicks one button, and translated subtitles appear fullscreen on their own screen. The audience reads them through the regular screen share — no app, no login, no second URL, no account for anyone in the room.
The flow is deliberately boring for everyone except the organizer:
- The organizer opens
/admin, picks the room label, the speaker language and the subtitle language, and gets a signed URL.
- The speaker opens that URL, grants microphone access, clicks Start mic, and shares their screen.
- Speech becomes text, text becomes translation, and the translation renders fullscreen with roughly two seconds of latency.
That is the whole product. One organizer action, one speaker action, zero audience actions. An English talk becomes readable in Portuguese, live, for a room that would otherwise have been left out.
How I built it
I started this in late June as a weekend project and kept coming back to it all summer. The first version worked in about a day. Everything after that was me arguing with myself about security and cost, which turned out to be where all the actual learning was.
Decision 1: keep the audio in the browser.
The obvious architecture is browser → my backend → Amazon Transcribe. I did not do that. The browser opens the WebSocket to Amazon Transcribe Streaming directly. No audio ever touches infrastructure I own, there is no server to scale with concurrent speakers, and my backend stays a single small Lambda that runs for a few milliseconds per room. Less code, less cost, less liability.
Decision 2: no user database, no Cognito.
Access control is a signed token:
base64url(payload) + "." + base64url(HMAC-SHA256(payload, SIGNING_SECRET)) , with an 8-hour expiry. A CloudFront Function validates that HMAC at the edge, before any request reaches an origin. Invalid or expired link? The request dies at the CDN and costs me effectively nothing. The /admin route is additionally locked to an IP allowlist by the same edge function.My first version used a Cognito Identity Pool with unauthenticated identities to hand AWS credentials to the browser. In August I ripped it out. An unauth identity pool is, by design, a credential vending machine for anyone who can read your JavaScript bundle. Now the browser calls
GET /api/session with the room token, the Lambda revalidates it, and only then calls sts:AssumeRole to vend short-lived credentials scoped to exactly two actions — Transcribe Streaming and Translate — with an aws:RequestedRegion condition. Without a live, signed, unexpired room token, there is nothing to steal.Decision 3: no shared secrets between CloudFront and Lambda.
The Lambda Function URL uses
AWS_IAM auth, and CloudFront Origin Access Control SigV4-signs every forwarded request with the distribution's own identity. The lambda:InvokeFunctionUrl permission is scoped to that specific distribution ARN. There is no principal = "*" , no shared header secret to rotate, and the Function URL never appears in the browser bundle.Challenges worth writing down:
- The
Authorizationheader is not yours. I spent hours on 403s before realizing CloudFront's OAC overwritesAuthorizationwith its own SigV4 signature on the way to the origin. The room token now travels in a customX-Room-Tokenheader.
- Timing-safe comparison does not exist at the edge. CloudFront Functions run a restricted JavaScript runtime — no
crypto.timingSafeEqual. I wrote a manual constant-time XOR loop instead.
- AWS SDK v3 in a browser bundle is a fight.
node:URI schemes, missing core polyfills, and a TypeScript version pin were all needed before webpack 5 would produce a working build.
-
terraform destroyon a versioned bucket lies to you. It fails unless you delete every version and every delete marker first. That is now a script in the destroy workflow.
Everything is Terraform. Deployment runs through GitHub Actions using OIDC — no long-lived AWS keys in GitHub, ever. Fork the repo, run the bootstrap once, trigger the workflow, and you have your own deployment. There is also a
destroy workflow, because a stack you cannot tear down in one click is a stack that quietly bills you forever. Both workflows and every run are public in the repo's Actions history.AWS services used and architecture
Service | Role |
|---|---|
Amazon Transcribe Streaming | Real-time speech-to-text over WebSocket, straight from the browser |
Amazon Translate | Translates each final phrase; skipped entirely when source and target language match |
AWS Lambda (Function URL, AWS_IAM ) | Signs room tokens, revalidates them, vends scoped STS credentials |
Amazon CloudFront + CloudFront Functions | Static hosting, OAC-signed origin requests, HMAC and IP validation at the edge |
Amazon S3 | Static React app bucket, private, reachable only through OAC |
AWS IAM + AWS STS | Two roles: Lambda execution, and a speaker-session role scoped to two actions in one region |
Amazon CloudWatch Logs | Lambda logs with 30-day retention |
AWS Budgets + Cost Anomaly Detection | $5/month budget alert and a $10 anomaly alert — opt-in, by email |
AWS WAF (optional, off by default) | Duplicates the IP allowlist when a documented compliance control is required |
Architecture Diagram:

Cost: idle cost is effectively $0/month with WAF off — S3 and CloudFront static requests come to under a cent. Active use is roughly $2.40 per speaker-hour (Transcribe Streaming at $0.024/min, plus Translate at ~$0.95/hr at 150 wpm, which drops to $0 when the languages match). A five-speaker, two-hour meetup costs about $24. Free Tier quotas can cover small events in the first year. A five-minute silence timeout auto-stops the stream, because the real cost risk in this design is not traffic — it is a speaker who forgets to click Stop.
That number matters more than it looks. A community meetup in the north of Brazil can absorb $24. It cannot absorb a per-seat SaaS contract. The architecture is the accessibility feature.
What I learned across the summer
Deleting code is the best refactor. The Cognito removal made the system simpler, cheaper, and more secure at the same time. I had assumed those three pulled in different directions. They mostly do not — complexity is usually what you are paying for in all three currencies at once.
Design the teardown before the launch. The
destroy workflow, the budget alert, and the anomaly detector shaped the architecture more than any feature did. Knowing I could delete the whole stack in one click is exactly why I felt free to keep rebuilding it.Push work to the edge and to the client. The two decisions I am proudest of — validating tokens in a CloudFront Function, and streaming audio straight from the browser — both removed a server from the diagram. What is left is small enough that I can hold the entire request path in my head.
Cost is a security control. Rate limiting, IP allowlists, token expiry, and the idle timeout are the same mechanism viewed from two angles. On a pay-per-use architecture, an abuse vector and a billing incident are the same event.
Build for the room you are actually in. The most useful constraint I had all summer was not technical. It was knowing the thing had to work on a personal AWS account, be set up by a volunteer organizer between other commitments, and cost roughly nothing when nobody is speaking. Every good decision in this project came from that constraint.
Coming from a DevOps background, my instinct was to reach for orchestration. This summer taught me that the better move is usually to ask what I can remove until the thing that is left is obviously correct.
Try it
- License: MIT — fork it, bootstrap once, run the deploy workflow, and it is yours.
The builder who inspired me
Thayana Mamoré (@thayanacmamore) — AWS User Group Leader and leader of Devs Norte. She is the reason I know AWS at all: she is the one who introduced me to it.
She is also the reason this project exists. Watching her organize event after event in the north of Brazil, I kept seeing the same gap she has been fighting for years — a community hungry for cutting-edge knowledge, and a language barrier standing between them and the people delivering it. She never let that stop her from bringing the content anyway. This is my attempt to remove the barrier instead of working around it.
Thank you, Thayana. This one is for your events.
Thanks also to Ben Fowler and the Builder Center team for running the Summer Build Series. See everyone in the New to AWS series.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article