AI agent for soccer analytics using AWS Bedrock AgentCore Runtime. Provides pre and post-game analytics via web chat interface.
- Prerequisites
- Quick Start
- Cost Estimate
- Complete Cleanup
- Architecture
- Troubleshooting
- Documentation
- Security
- Development
- License
- Isolated billing and cost tracking
- No impact on existing AWS resources
- Easy cleanup without affecting other workloads
- Clear cost attribution
Learn how to create an AWS account in an organization
- Python 3.12+:
python --version - uv package manager:
pip install uv - AWS CLI:
aws --version - AWS CDK:
npm install -g aws-cdk - Docker:
docker --version - Git:
git --version
- AWS SSO: Configured for secure authentication
- Bedrock Access: Claude Sonnet 4.5 model enabled in us-east-1
- IAM Permissions: Administrator access or permissions for IAM, S3, DynamoDB, Lambda, Cognito, Bedrock, ECR, CloudWatch, ECS
Before deployment, enable Claude Sonnet 4.5 in AWS Bedrock:
- Go to AWS Bedrock Console (us-east-1 region)
- Navigate to Model access in the left sidebar
- Click Manage model access
- Find Anthropic β Claude Sonnet 4.5 and enable it
- Click Save changes and wait for access to be granted (~2-5 minutes)
git clone <repository-url>
cd the-beautiful-gameupdate the params as you see fit
# Configure AWS SSO (one-time setup)
aws configure sso
# Follow prompts:
# - SSO start URL (from your AWS administrator)
# - SSO region (typically us-east-1)
# - Account ID and role name
# - CLI default region: us-east-1
# - Output format: json
# - Profile name: soccer-analytics
# Login to AWS SSO
aws sso login --profile soccer-analytics
# Verify authentication
aws sts get-caller-identity --profile soccer-analytics# Install dependencies
uv pip install -e .
# Bootstrap CDK (first time only)
cdk bootstrap
# Deploy infrastructure
cdk deploy --all --outputs-file cdk-outputs.jsonDeployment time: ~5-10 minutes
What gets created:
- DynamoDB tables (GameData, RateLimits)
- S3 bucket for PDF schedules
- Lambda function for PDF processing
- Cognito User Pool and Identity Pool
- IAM roles and policies
# Get bucket name
BUCKET_NAME=$(cat cdk-outputs.json | grep -o '"PdfBucketName": "[^"]*"' | cut -d'"' -f4)
# Upload sample schedule
aws s3 cp data/samples/sample-schedule.pdf s3://$BUCKET_NAME/sample-schedule-$(date +%s).pdf# Get User Pool ID from CDK outputs
USER_POOL_ID=$(cat cdk-outputs.json | grep -o '"UserPoolId": "[^"]*"' | cut -d'"' -f4)
# Create test user
./scripts/create_test_user.sh $USER_POOL_ID testuser TestPass123! test@example.comcd agentcore
uv run python deploy_agent.py
cd ..Deployment time: ~10-15 minutes (first time), ~5 minutes (subsequent)
What happens:
- Builds Docker image with AI agent
- Pushes to ECR
- Deploys to Bedrock AgentCore Runtime
- Configures IAM permissions for DynamoDB and Bedrock
uv run python streamlit_app/deploy_ecs.pyDeployment time: ~10-15 minutes
What gets created:
- ECS Fargate cluster and service
- Application Load Balancer
- Security groups and IAM roles
# Get the public URL
./streamlit_app/get_ecs_url.sh
# Open the URL in your browser
# Login with: testuser / TestPass123!
# Try: "predict next LBFC game"| Service | Cost |
|---|---|
| Bedrock AgentCore Runtime | ~$50-100 |
| ECS Fargate (1 task, 1 vCPU, 2GB) | ~$15-20 |
| DynamoDB (on-demand, light usage) | ~$5-10 |
| S3 Storage (< 1GB) | ~$0.50 |
| CloudWatch Logs | ~$2-5 |
| Application Load Balancer | ~$16-20 |
| Total | ~$90-155/month |
Pause when not in use (recommended):
# Pause ECS service (stops UI, saves ~$35/month)
uv run python streamlit_app/deploy_ecs.py --pause
# Resume when needed
uv run python streamlit_app/deploy_ecs.py --resumePaused costs: ~$55-120/month (AgentCore + DynamoDB + S3 + Logs)
To delete all resources and stop all charges:
cd scripts
./cleanup_all.shThis will delete (in order):
- ECS cluster and services
- AgentCore runtime and CodeBuild
- CDK stack (Lambda, DynamoDB, S3, Cognito)
- ECR repositories
- CloudWatch log groups
- Local configuration files
Verification:
# Verify all resources are deleted
aws cloudformation list-stacks --stack-status-filter CREATE_COMPLETE UPDATE_COMPLETE | grep soccer-analytics
# Should return nothing- Backend: AWS Bedrock AgentCore Runtime with Strands framework
- Frontend: Streamlit web UI on ECS Fargate
- Data: S3 for PDFs, DynamoDB for structured game data
- Authentication: AWS Cognito User Pool + Identity Pool
- Infrastructure: AWS CDK (TypeScript)
For detailed troubleshooting, see:
- π Deployment Guide
- π Troubleshooting Guide
CDK Deploy Fails:
aws sso login --profile soccer-analytics
cdk bootstrap --forceAgentCore Deploy Fails:
# Verify Bedrock access
aws bedrock list-foundation-models --region us-east-1 | grep claude-sonnet-4Streamlit Login Fails:
# Verify user exists
aws cognito-idp list-users --user-pool-id $USER_POOL_IDCheck Logs:
# Lambda logs
aws logs tail /aws/lambda/soccer-analytics-pdf-processor --follow
# AgentCore logs
aws logs tail /aws/bedrock-agentcore/soccer_analytics_agent --followπ Complete documentation: docs/README.md
- π¦ Deployment Guide - Detailed deployment instructions
- π° Cost Control - Budget management and monitoring
- π Security - Security best practices
- π Troubleshooting - Common issues and solutions
- π€ AgentCore - AI agent development
- π Streamlit UI - Web interface details
- AWS SSO authentication (no long-lived access keys)
- Temporary credentials via Cognito Identity Pool
- Encrypted data at rest and in transit
- IAM least privilege access
# Run tests
uv run pytest -q
# Lint code
uv run ruff check
# Format code
uv run black .
# Type check
uv run mypy .MIT License - see LICENSE file for details.
Copyright (c) 2025 The Project Contributors
