AWS Builder Center
A hackathon backend in an afternoon: Lambda, API Gateway and DynamoDB

A hackathon backend in an afternoon: Lambda, API Gateway and DynamoDB

The serverless stack I would use to get an API and database live fast at a hackathon, how to design DynamoDB keys around your queries, deploying with SAM or CDK, and the five mistakes that eat hours: CORS, timeouts, secrets, blind debugging and cold starts.

Series: Ship It on AWS: A Hackathon Builder's Playbook (3 articles)

  1. 2
    A hackathon backend in an afternoon: Lambda, API Gateway and DynamoDB This article
In Part 1, I shared my checklist for not getting a surprise AWS bill after a hackathon. This time it's the other half of the problem: getting a working backend up fast, so you can spend the weekend on the idea instead of on servers.
Almost every hackathon demo needs the same three things: an endpoint the frontend can call, some logic, and somewhere to store data. Here's the serverless stack I'd reach for, and the mistakes that eat hours.

The stack

Need
Service
Why it suits a hackathon
Logic
AWS Lambda
No servers to manage, and it costs almost nothing when idle
HTTP endpoint
Lambda function URL or API Gateway HTTP API
One URL your frontend can call
Data
Amazon DynamoDB (on-demand mode)
No capacity planning, and you pay per request
Frontend
AWS Amplify Hosting or S3 + CloudFront
Connect a Git repo and get a live URL

Step 1: Pick the simplest endpoint that works

  • Lambda function URL: a built-in HTTPS endpoint for a single function. For a demo with one or two routes, this is the fastest option.
  • API Gateway HTTP API: use it when you need several routes, authorization or a custom domain. It's simpler and cheaper than the older REST API type for most hackathon use.
Don't build a perfect API layer on day one. Start with a function URL and move to API Gateway only if you actually need its features.

Step 2: Design DynamoDB around your queries

The common mistake is copying a SQL schema into DynamoDB. Instead, write down the 3 or 4 queries your demo needs, then choose keys that answer them.
For example, in a team project tracker:
  • Partition key:  team_id 
  • Sort key:  created_at 
Now "get all tasks for team X, newest first" is one  Query . Use on-demand capacity so you never think about read and write units during the event.

Step 3: Deploy with infrastructure as code

Clicking through the console works once, but breaks when a teammate needs to redeploy at 3 a.m. A small AWS SAM template or CDK app gives you:
  • One command to deploy ( sam deploy  or  cdk deploy )
  • The same setup on every teammate's machine
  • One command to delete everything after the demo (Part 1's teardown step)

The mistakes that cost hours

  1. CORS errors. The browser blocks your frontend's calls because the endpoint doesn't send the right headers. Configure CORS on the function URL or API Gateway early, before the frontend is built, not at midnight.
  1. Timeouts. Lambda's default timeout is only 3 seconds. If you call an AI model or a slow external API, raise it. Also remember that API Gateway has its own integration timeout of roughly 30 seconds, so very long tasks need a different pattern (for example, process in the background and poll).
  1. Hardcoded secrets. Put API keys in environment variables backed by Parameter Store or Secrets Manager, never in the code you push to GitHub.
  1. Debugging blind. Every  print  or  console.log  in Lambda lands in CloudWatch Logs. Open the log group the moment something fails instead of guessing. Set a short log retention so old logs don't pile up.
  1. Cold starts in the demo. The first request after a quiet period can be slower. Hit your endpoint once just before you present.

The takeaway

Function URL or HTTP API → Lambda → DynamoDB, deployed with SAM or CDK, gets most hackathon backends running in an afternoon.
Spend the time you save on the part judges actually see: the idea and the demo.
What's your go-to hackathon backend stack? Tell me in the comments, I'm collecting ideas for the next part.
Next in this series: making your demo look production-ready, with custom domains, HTTPS and a clean deploy pipeline.

Series: Ship It on AWS: A Hackathon Builder's Playbook (3 articles)

  1. 2
    A hackathon backend in an afternoon: Lambda, API Gateway and DynamoDB 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