How aws-samples/sample-devgenius-aws-solution-builder works
Project type and purpose
• DevGenius is a full-stack, cloud-native AI application.
• It provides a conversational Streamlit frontend, backed by an Amazon Bedrock AI engine, to generate AWS solution architectures, cost estimates, infrastructure-as-code (CDK/CloudFormation), and documentation.
File structure
• Top-level “chatbot/” directory holds the Streamlit UI code (agent.py + widget modules), styles, layout, Dockerfile, and Python utilities.
• “lib/” contains the AWS CDK stack (TypeScript), including:
• edge-lambda/ (Lambda@Edge auth function in Node.js)
• lambda/ (supporting Python Lambdas for vector operations, OSS index lookups, prefix lists)
• layer/ (Python dependencies for the Lambdas)
• Configuration files: cdk.json, tsconfig.json, package.json, requirements.txt.
README for additional insights
• Confirms AWS architecture: Streamlit UI on ECS Fargate behind an ALB, CloudFront + Lambda@Edge for auth, Amazon Cognito, Bedrock Agent & Knowledge Base, OpenSearch Serverless, S3, DynamoDB.
• Describes deployment flow: local development vs Docker vs CDK deploy.
a. Main components
• Users & Browser
• CDN & Edge: CloudFront + Lambda@Edge (request validation/auth hook)
• Authentication: Cognito User Pool & Identity Pool
• Frontend container: ECS Fargate running Streamlit app (chatbot/agent.py + widgets) behind an Application Load Balancer
• AI Engine: Amazon Bedrock Agent + Amazon Bedrock Knowledge Base
• Vector Search: Amazon OpenSearch Serverless for embeddings
• Data Stores:
• Amazon DynamoDB for conversations and session tracking
• IaC Generation: CDK (lib/index.ts) producing CloudFormation templates
• Edge Lambdas: Node.js Lambda@Edge (lib/edge-lambda)
• Auxiliary Lambdas: Python Lambdas (lib/lambda) for supporting services
b. Relationships and interactions
1. User’s browser → CloudFront distribution
2. CloudFront → Lambda@Edge (auth/validation) → ALB
3. ALB → ECS Fargate container (Streamlit UI)
4. UI ↔ Cognito for signup/sign-in
6. Bedrock Agent ↔ Bedrock Knowledge Base
7. UI → DynamoDB (session & conversation storage)
8. UI → S3 (store/retrieve generated assets)
9. UI → OpenSearch Serverless (vector search retrieval)
10. UI → CDK (invokes lib/index.ts to synth/deploy infra)
c. Architectural patterns & design principles
• Microservices & serverless: stateless container for UI, serverless lambdas for edge auth and helper logic
• Separation of concerns: UI vs AI engine vs storage vs IaC
• Infrastructure as code: AWS CDK modular stacks
• Event-driven & API-driven interactions between components
d. Key technologies & frameworks
• Frontend: Python 3.12+ with Streamlit
• AI: Amazon Bedrock (Claude models) + custom Knowledge Base
• IaC: AWS CDK (TypeScript) & CloudFormation
• Compute: ECS Fargate, Lambda@Edge, Python Lambdas
• Storage: S3, DynamoDB, OpenSearch Serverless
• Auth & CDN: Amazon Cognito, CloudFront
• Local tooling: Docker, AWS CLI, CDK CLI
Elements
• Clear labels on every component (e.g., “ECS Fargate (Streamlit)”, “Amazon Bedrock Agent”).
• Compute (containers/lambdas) in blue
• Data stores in green
• AI services in purple
• Networking (CDN, ALB) in orange
• Auth in yellow