Documentation Index
Fetch the complete documentation index at: https://mintlify.com/GingerlyData247/SOTeam4-P2/llms.txt
Use this file to discover all available pages before exploring further.
Architecture Overview
The Trustworthy Model Registry is designed as a cloud-native application deployed entirely on AWS using free-tier-compatible components.AWS Components
AWS Lambda
Stateless execution of the FastAPI backend using the Mangum adapter
API Gateway
Public REST interface with CORS configuration
Amazon S3
Artifact storage and registry persistence (registry.json)
CloudWatch
Logs, metrics, and system health monitoring
All components are selected to remain within AWS Free Tier limits:
- Lambda: 1M free requests/month, 400,000 GB-seconds compute
- API Gateway: 1M API calls/month for first 12 months
- S3: 5GB storage, 20,000 GET requests, 2,000 PUT requests
- CloudWatch: 5GB log data, 10 custom metrics
Mangum Adapter
The application uses Mangum to adapt the FastAPI application for AWS Lambda execution:src/main.py
- AWS Lambda events → ASGI requests
- ASGI responses → AWS Lambda responses
- Locally with Uvicorn
- In production on AWS Lambda
Deployment Process
Prerequisites
AWS Account
Create an AWS account with appropriate IAM permissions for Lambda, API Gateway, S3, and CloudWatch.
1. Create S3 Bucket
Create an S3 bucket for artifact storage:2. Create Lambda Function
Create the Lambda function:The handler path is
src.main.handler, which refers to the handler variable in src/main.py.3. Create IAM Role
The Lambda function requires an execution role with the following permissions:4. Configure API Gateway
Create a REST API in API Gateway:CORS Configuration
The application handles CORS at the FastAPI level:src/main.py
5. Deploy to Lambda
Update the function code:6. Test the Deployment
Verify the health endpoint:Environment Configuration for AWS
Lambda environment variables are configured during function creation or update:Required Variables
| Variable | Description | Example |
|---|---|---|
S3_BUCKET | S3 bucket name for artifact storage | sot4-model-registry-artifacts |
AWS_REGION | AWS region (auto-detected in Lambda) | us-east-2 |
AUTH_TOKEN | Default authentication token | your-secret-token |
Optional Variables
| Variable | Description | Default |
|---|---|---|
HUGGINGFACE_HUB_TOKEN | HuggingFace API token | None |
GITHUB_TOKEN | GitHub API token | None |
LOG_LEVEL | Logging verbosity (0=silent, 1=INFO, 2=DEBUG) | 0 |
LOG_FILE is not used in Lambda deployments. All logs automatically go to CloudWatch.CloudWatch Logging
The application uses custom ASGI middleware for request/response logging:src/api/middleware/log_requests.py
Viewing Logs
View logs in CloudWatch:- Navigate to CloudWatch > Log groups
- Select
/aws/lambda/trustworthy-model-registry - View log streams
Continuous Deployment (CI/CD)
The project includes GitHub Actions for automated deployment:CI Pipeline
Triggered on every pull request:- Runs unit, feature, and end-to-end tests
- Enforces minimum coverage thresholds
- Performs linting and static checks
CD Pipeline
Triggered on merge to main branch:- Automatically deploys the service to AWS
- Verifies successful startup and health endpoint
- Uses GitHub Secrets for AWS credentials
See
.github/workflows/ in the repository for CI/CD configuration details.Monitoring and Observability
Health Endpoint
The/api/health endpoint provides system status:
CloudWatch Metrics
Monitor Lambda execution:- Invocations: Total number of requests
- Duration: Execution time per request
- Errors: Failed invocations
- Throttles: Rate-limited requests
Request Logging
All requests are logged with:- Request method and path
- Response status code
- Execution time
- Error details (if applicable)
Free Tier Considerations
Cost Optimization Tips
Troubleshooting
Lambda Timeout Errors
Lambda Timeout Errors
Increase the timeout setting:
S3 Access Denied
S3 Access Denied
- Verify the Lambda execution role has S3 permissions
- Check the S3 bucket policy allows Lambda access
- Ensure
S3_BUCKETenvironment variable is set correctly
CORS Errors
CORS Errors
- Update
ALLOWED_ORIGINSinsrc/main.py - Clear API Gateway CORS settings (application handles CORS)
- Check browser console for specific CORS error details
Cold Start Performance
Cold Start Performance
- Consider Lambda provisioned concurrency for production
- Optimize package size by removing unused dependencies
- Use Lambda layers for common dependencies
Next Steps
Configuration
Explore all environment variable options
API Overview
Learn about available API endpoints