This repository demonstrates how to set up a serverless leaderboard API using the AWS Serverless Application Model (SAM).
It provisions a fully managed backend with AWS Lambda, Amazon API Gateway, and Amazon DynamoDB — ideal for learning or testing AWS serverless architectures.
⚠️ Note: This project is not production-ready.
It’s an example for understanding the setup and deployment process, not a complete or optimized implementation.
Use it as a reference to explore infrastructure setup, CI/CD integration, or AWS SAM project structure for serverless applications.
- Store scores per user
- Fetch a global leaderboard (top scores across all users)
- Example scripts to build, deploy, seed, and query
- Tear down resources when done
Before you begin, make sure you have:
- An AWS account with credentials configured
- AWS CLI
- AWS SAM CLI
- Docker (optional, for local building/emulation)
- Python 3.8+ (tested with 3.13 runtime in Lambda)
- jq, tomlq
-
Check or change the target region in samconfig.toml
-
Build the application:
sam build
-
Deploy the application:
sam deploy
-
Refresh local resource IDs (helps some helper scripts):
./refresh-resourceids.sh
- Hello World!
./run_hello_world.sh
- Get current leaderboard
./run_get_topscores.sh
- Create random scores
./run_create_scores.sh
- Check leaderboard again
./run_get_topscores.sh
When you’re done experimenting, clean up resources to avoid charges:
./delete-stack.sh- DynamoDB table and API Gateway are pay-per-request, but you may still incur small costs if left running.
- The project is intentionally minimal and insecure (no authentication).
- Use this as a sandbox to learn AWS SAM, not for production workloads.