AI-Powered Trading Card Generation for AWS Events
Generate personalized trading cards and videos using Amazon Bedrock Nova Canvas & Nova Reel
SnapMagic creates AI-generated trading cards and videos for AWS events using Amazon Bedrock. Users enter text prompts like "AWS Solutions Architect designing cloud infrastructure" and get personalized trading cards with holographic styling, plus animated videos.
Perfect for: AWS re:Invent, customer summits, partner events, conferences
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β AWS AMPLIFY β β API GATEWAY β β MAIN LAMBDA β β SQS β
β β β β β β β β
β β’ Frontend Host βββββΆβ β’ REST API βββββΆβ β’ AuthenticationβββββΆβ β’ Card Queue β
β β’ GitHub Deployβ β β’ CORS Config β β β’ Job Creation β β β’ Concurrency β
β β’ Auto Build β β β’ JWT Validationβ β β’ Gallery Load β β β’ Dead Letter Q β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β β
βΌ βΌ
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β DYNAMODB β β S3 β β QUEUE PROCESSOR β β AMAZON BEDROCK β
β ββββββ ββββββ LAMBDA βββββΆβ β
β β’ Job Tracking β β β’ File Storage β β β’ AI Generation β β β’ Nova Canvas β
β β’ Metadata β β β’ Presigned URLsβ β β’ File Upload β β β’ Nova Reel β
β β’ GSI Queries β β β’ 7-day Access β β β’ Status Update β β β’ Text-to-Image β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
- Frontend (Amplify): User enters prompt via web interface
- API Gateway: Routes request to Main Lambda with CORS/JWT validation
- Main Lambda: Creates job in DynamoDB, sends message to SQS queue
- SQS Queue: Manages Bedrock concurrency (max 2 concurrent generations)
- Queue Processor Lambda: Picks up job, calls Nova Canvas for AI generation
- Bedrock Nova Canvas: Generates 1280Γ720 trading card image from text
- S3 Storage: Queue Processor saves image, updates DynamoDB with S3 key
- Gallery Loading: Main Lambda queries DynamoDB, generates 7-day presigned URLs
- Frontend Display: Shows cards with CSS holographic template styling
- AWS Amplify: Frontend hosting, GitHub integration, auto-build, environment variables
- API Gateway: REST API endpoints, CORS configuration, request routing
- AWS Lambda (2 functions):
- Main Lambda: API processing, authentication, job management, gallery loading
- Queue Processor Lambda: AI generation, file storage, status updates
- Amazon SQS: Card generation queue + Dead Letter Queue for failed jobs
- Amazon DynamoDB: Job tracking table with GSI for device-based queries
- Amazon S3: File storage with presigned URL security and CORS configuration
- Amazon Bedrock: Nova Canvas (images) + Nova Reel (videos) AI models
- CloudWatch: Logging and monitoring for all components
- AWS Account with admin access
- Bedrock Access: Go to AWS Console β Bedrock β Model Access β Request access to:
- β Amazon Nova Canvas (image generation)
- β Amazon Nova Reel (video generation)
- GitHub Token: Generate here with
reposcope - Fork this repo to your GitHub account
git clone https://github.com/YOUR-USERNAME/SnapMagic.git
cd SnapMagic
cp secrets.json.example secrets.json{
"github": {
"repositoryUrl": "https://github.com/YOUR-USERNAME/SnapMagic",
"token": "ghp_YOUR_GITHUB_TOKEN_HERE",
"branch": "main"
},
"app": {
"name": "my-snapmagic-app",
"region": "us-east-1"
}
}- Use YOUR forked repository URL
- Must be
us-east-1region (Bedrock Nova models) - GitHub token needs
repopermissions
cd infrastructure
npm install
cdk bootstrap --region us-east-1
cdk deploy SnapMagic-dev --region us-east-1- Frontend URL: Shown in CDK output as
AmplifyAppUrl - Login:
demo/demo(or your configured credentials) - Ready: Generate cards immediately!
- Login with demo credentials
- Enter prompt: "AWS Lambda expert building serverless applications"
- Wait 30 seconds for AI generation
- Download PNG or generate video
- All your cards saved automatically
- 7-day presigned URL access
- Mobile-friendly display
- Social sharing ready
- Click "Generate Video" on any card
- Nova Reel animates your trading card
- Download MP4 for social media
-
Main Lambda (
SnapMagicAIFunction):- Handles all API requests (login, job creation, gallery loading)
- JWT authentication and validation
- DynamoDB job creation and queries
- Presigned URL generation for gallery
- SQS message sending for card generation
- 700 concurrent executions for high API traffic
-
Queue Processor Lambda (
QueueProcessorFunction):- Dedicated to AI generation only
- Triggered by SQS messages
- Calls Amazon Bedrock Nova Canvas
- Uploads generated images to S3
- Updates DynamoDB job status
- 200 concurrent executions (respects Bedrock limits)
- Main Queue:
snapmagic-card-generation-dev- 90-second visibility timeout (AI generation time)
- 20-second long polling for instant pickup
- Handles Bedrock concurrency limits (max 2 simultaneous)
- Dead Letter Queue:
snapmagic-card-generation-dlq-dev- 3 retry attempts before moving to DLQ
- 14-day retention for failed jobs
- Table:
snapmagic-jobs-dev-{timestamp}- Primary Key:
jobId(UUID) - GSI:
device-override-indexfor fast gallery queries - Tracks: job status, prompts, S3 keys, timestamps, user metadata
- Pay-per-request billing for cost efficiency
- Primary Key:
- Bucket:
snapmagic-videos-dev-{account}-{timestamp}- Security: Direct URLs blocked, presigned URLs allowed
- CORS: Configured for GET, HEAD, PUT methods
- Presigned URLs: 7-day expiration (maximum AWS allows)
- Auto-cleanup: Files deleted when CDK stack destroyed
- GitHub Connection: Auto-deploys on code changes
- Environment Variables: API Gateway URL injected automatically
- Build Process: Replaces placeholders with actual API endpoints
- Custom Domain: Optional custom domain support
For 100 users generating 5 cards each:
- Bedrock Nova Canvas: ~$67 (500 images)
- Lambda: ~$1 (processing)
- DynamoDB: ~$1 (metadata)
- S3: ~$2 (storage)
- Total: ~$71 ($0.71 per user)
Compare to traditional event engagement: $50-100 per person
- Add logos to
frontend/public/logos/as1.png,2.png, etc. - Update event name in
secrets.json - Logos appear automatically in card template
- Demo mode:
demo/demo - Custom credentials in
secrets.json - JWT-based with configurable expiration
- Cards per user: 5 (default)
- Videos per user: 3 (default)
- Override system for staff unlimited access
- "Access Denied" for Bedrock: Request Nova Canvas/Reel access in us-east-1
- Cards not generating: Check CloudWatch logs for Lambda errors
- Gallery images not loading: Verify S3 presigned URL configuration
- Frontend shows API errors: Confirm API Gateway URL in Amplify environment
- CloudWatch:
/aws/lambda/SnapMagic-*log groups - DynamoDB: Check job status in
snapmagic-jobs-*table - S3: Verify files in
snapmagic-videos-*bucket
- Serverless: Zero server management, infinite scale
- Cost-Effective: Pay only for usage, not idle time
- Reliable: AWS managed services, 99.9%+ uptime
- Secure: IAM roles, presigned URLs, encrypted storage
- Fast: DynamoDB queries, S3 CDN-ready storage
- Well-Architected Framework compliance
- Infrastructure as Code (CDK)
- Monitoring and logging built-in
- Account-agnostic deployment
After deployment, you'll have:
- β AI Card Generation: 30-second creation time
- β Gallery System: Instant loading with presigned URLs
- β Video Creation: 60-second animated videos
- β Mobile Experience: Works on all devices
- β Social Sharing: 7-day accessible links
Transform your AWS events with AI-powered engagement! π
Built with β€οΈ for the AWS Community
Questions? Check CloudWatch logs or create an issue.