How aws-samples/bedrock-serverless-workshop works
Project type and purpose
• This is a full-stack, serverless generative-AI chatbot application built as an AWS SAM (Serverless Application Model) solution.
• The frontend is a Vue.js/Amplify web UI; the backend is a set of AWS Lambda functions orchestrated via API Gateway, with authentication in Cognito, retrieval in Amazon Kendra, and text generation in Amazon Bedrock.
File structure
• Top-level:
• frontend/ – Vue.js + Amplify SPA
• lambdas/ – multiple Lambda handlers organized by function: bedrockFunc, llmFunctions, ragFunctions
• template.yaml – SAM template declaring AWS resources (API Gateway, Lambda, Cognito, etc.)
• prompt-engineering/ – prompt templates used by Lambdas
• Tools and scripts for account setup, deployment, and resizing are in tools/ and aws-creds.py.
README for additional insights
• The README confirms the use of RAG (Retrieval-Augmented Generation) with Amazon Kendra for indexing & retrieval, and Amazon Bedrock as the foundation-model API.
• Describes a Cognito user pool for auth, API Gateway endpoints for client-to-Lambda calls, and the use of SAM CLI to deploy.
a. Main components
• Client / Web UI (Vue.js + Amplify)
• AWS Cognito User Pool (authentication)
• Amazon API Gateway (REST endpoints)
• AWS Lambda functions (Auth, RAG, LLM, KB)
• Amazon Kendra (search & retrieve)
• Amazon Bedrock (foundation model inference)
• AWS SAM / CloudFormation (infrastructure as code)
b. Relationships & interactions
1. User opens UI → signs in via Amplify/Cognito
2. Authenticated requests → API Gateway endpoints
3. API Gateway routes to appropriate Lambda (e.g., /rag → ragfunction)
4. ragfunction calls Kendra to fetch context, then Bedrock to generate answer
5. LLM functions may call Bedrock directly; KB functions index or query Kendra
6. Lambda returns response → API Gateway → UI
c. Architectural patterns & principles
• Serverless microservices: each business function in its own Lambda
• Clear separation: UI vs. API vs. compute vs. external services
• Infrastructure as code via SAM for repeatable, versioned deployment
d. Key technologies & libraries
• Frontend: Vue, AWS Amplify, aws-exports.js, vue-router
• Backend: AWS Lambda (Python), boto3 (AWS SDK), prompt templates
• Services: AWS Cognito, API Gateway, Kendra, Bedrock, SAM
Essential details to capture
• Authentication handshake via Cognito
• API Gateway method endpoints (e.g., /rag, /llm, /kb)
• Individual Lambda “microservices” by folder grouping
• Interaction between RAG Lambda and Kendra + Bedrock
• Prompt-engineering folder as an internal library used by the Lambdas
• The SAM template as the single source of deployed resources