This Game has been created for and submitted to the AWS Game Builder Challenge (https://devpost.com/software/aws-serverless-ai-powered-language-game)
This repository contains the code and infrastructure for a Children Language Game, a cloud-native application designed to help young children who cannot yet read or write learn new languages in an interactive and engaging way. The game uses a combination of images and AI-generated audio content to enhance the learning experience. Built on AWS, it leverages services such as Lambda, DynamoDB, S3, and CloudFront to deliver a serverless, scalable, and highly available architecture.
.
├── frontend
│ ├── assets #game assets: images and audio files
│ │ ├── audio #audio files for each game category
│ │ │ ├── animals
│ │ │ ├── colors
│ │ │ ├── fruits
│ │ │ └── vegetables
│ │ └── images #image files for each game category
│ │ ├── animals
│ │ ├── categories
│ │ ├── colors
│ │ ├── favicon
│ │ ├── flags
│ │ ├── fruits
│ │ └── vegetables
│ └── src #static frontent code html, js and css files
│ ├── dev
│ └── prod
├── lambda
│ ├── app.py #lambda function for game setup
│ └── requirements.txt
├── README.md
├── scripts
| ├── deploy_frontend.sh #script to deploy frontend
│ ├── add-new-game-objects.py #utility script for adding new objects to the game
└── template.yaml #sam template
- AWS CLI (https://aws.amazon.com/cli/) configured with appropriate credentials
- AWS SAM CLI (https://aws.amazon.com/serverless/sam/) installed
- Python 3.8+ (for backend development).
- AWS Account with appropriate permissions
-
Frontend:
- Hosted on S3 and distributed via CloudFront.
- Static files (HTML, CSS, JavaScript) for game pages and user interactions.
- Assets include categorized images and audio files for the game.
-
Backend:
- DynamoDB table (
language-game
) with primary keycategory
and sort keyenglish
. - AWS Lambda function (
app.py
) for serverless business logic. - Serverless API Gateway with Lambda Integration
- DynamoDB table (
-
Infrastructure:
- Defined using AWS SAM for easy deployment and management.
- Secure communication between the frontend and backend.
-
Scripts:
- deploy_frontend.sh - to automatically deploy frontend
- add-new-game-objects.py - python script leveraging boto3 for adding new game object and creating new game categories
sam build
sam deploy --guided
Follow the prompts to configure the stack name, region, and S3 bucket for deployment artifacts.
Get the bucket name from the output from the previous command and deploy the frontend using the script
S3BUCKETNAME="<bucketname>" ./scripts/deploy_frontend.sh
Run the script to invalidate cached assets:
aws cloudfront create-invalidation --distribution-id <distribution-id> --paths "/*"
- Create Test Event
vi events/event.json
{
"key1": "value1",
"key2": "value2",
"key3": "value3"
}
- Test Lambda Function Locally
sam local invoke --event events/event.json LanguageGameLambda
- place image files in local directory
- ensure filenames correspond to english word of image content
- modify the IMAGE_DIR and CATEGORY variables in the script to match your requirements
- set Environment Variables S3_BUCKET_NAME and DYNAMODB_TABLE_NAME in terminal environment
- run script
python3 add-new-game-objects.py
- the script will automatically translate the english words (filenames) into foreign languages, generate audio files using Amazon Polly, upload the images and audio files to the s3 bucket, store the image and audio urls as well as the translations into the dynamodb table
- run frontend deploy script after changes have been made
S3BUCKETNAME="<bucketname>" ./scripts/deploy_frontend.sh
- Amazon S3: Stores and serves static assets (frontend).
- Amazon CloudFront: Distributes frontend content globally with low latency.
- AWS Lambda: Executes backend logic.
- Amazon DynamoDB: Stores game data.
- Amazon API Gateway: Connects the frontend to backend Lambda functions.
- Amazon Translate: Translates english words into foreign languges
- Amazon Polly: AI Voice Generator to generate audio files from text
- AWS Serverless Application Model: Deploy AWS Infrastructure as code
- Amazon Q: AI Assistant for AWS Setup and Code Suggestions
- AWS SDK for Python (Boto3): Programmatic Interaction with AWS Ressources
- Environment variables are used for sensitive configuration
- AWS IAM roles and policies manage access control
- Secure API endpoints for frontend-backend communication
- Built with AWS SAM and other AWS services as part of the AWS Game Builders Challenge (https://devpost.com/software/aws-serverless-ai-powered-language-game).
- Inspired by serverless design patterns for scalable applications.
Feel free to reach out with any questions or suggestions!