🏗️ Architecture Overview
Internet Users
│
├── CloudFront Distribution (E2CRYM24VDXR9E)
│ └── S3 Bucket: rusaiagent1
│ └── Frontend: React-style chat interface
│
├── API Gateway (jnwh6iu2ki)
│ └── /prod/chat endpoint
│ └── Lambda Function: aws-cloud-assistant-chatbot
│ ├── AWS service knowledge base
│ ├── Pricing information
│ ├── Troubleshooting guidance
│ └── Architecture recommendations
│
└── AWS Services Used:
├── Lambda (Python 3.9)
├── API Gateway (REST API)
├── IAM (Execution roles)
├── S3 (Static hosting)
└── CloudFront (CDN)
📄 backend/simple-chatbot-handler.py
Purpose: Enhanced Lambda function with Rus's personality and 10 AWS services
import json
import boto3
import logging
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def lambda_handler(event, context):
"""
AWS Cloud Assistant Chatbot Handler
Processes requests and provides AWS service information
"""
logger.info(f"Received event: {json.dumps(event)}")
try:
# Extract intent and session information
intent_name = event['sessionState']['intent']['name']
slots = event['sessionState']['intent']['slots']
session_id = event['sessionId']
# Route to appropriate handler based on intent
if intent_name == 'GetServiceInfo':
return handle_service_info(event, slots)
elif intent_name == 'GetPricing':
return handle_pricing_info(event, slots)
elif intent_name == 'GetTroubleshooting':
return handle_troubleshooting(event, slots)
else:
return handle_fallback(event)
except Exception as e:
logger.error(f"Error processing request: {str(e)}")
return handle_error(event)
def handle_service_info(event, slots):
"""Handle AWS service information requests"""
# AWS service knowledge base
aws_services = {
'lambda': {
'name': 'AWS Lambda',
'description': 'Serverless compute service...',
'use_cases': 'API backends, data processing...',
'pricing': 'Pay per request and compute time...'
},
# ... more services
}
# Extract service name from user input
user_input = event.get('inputTranscript', '').lower()
service_found = None
for service_key, service_info in aws_services.items():
if service_key in user_input:
service_found = service_info
break
if service_found:
response_text = f"**{service_found['name']}**\\n\\n"
response_text += f"📋 **Description**: {service_found['description']}\\n\\n"
response_text += f"🎯 **Use Cases**: {service_found['use_cases']}\\n\\n"
response_text += f"💰 **Pricing**: {service_found['pricing']}"
else:
response_text = "I can help you learn about AWS services..."
return create_response(event, response_text)
🌐 frontend/index.html
Purpose: Professional chat interface with real-time messaging
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>AWS Cloud Assistant</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #232F3E 0%, #131A22 100%);
color: #ffffff;
height: 100vh;
display: flex;
flex-direction: column;
}
.chat-container {
flex: 1;
display: flex;
flex-direction: column;
max-width: 800px;
margin: 0 auto;
width: 100%;
padding: 20px;
}
.chat-messages {
flex: 1;
overflow-y: auto;
padding: 20px;
background: rgba(255, 255, 255, 0.05);
border-radius: 10px;
margin-bottom: 20px;
min-height: 400px;
}
.message {
margin-bottom: 15px;
padding: 12px 16px;
border-radius: 10px;
max-width: 80%;
word-wrap: break-word;
}
.user-message {
background: #FF9900;
color: #000;
margin-left: auto;
text-align: right;
}
.bot-message {
background: rgba(255, 255, 255, 0.1);
color: #ffffff;
border-left: 4px solid #FF9900;
}
</style>
</head>
<body>
<div class="chat-container">
<div class="chat-messages" id="chatMessages">
<div class="message bot-message">
👋 <strong>Welcome to AWS Cloud Assistant!</strong><br><br>
I'm here to help you with AWS services, pricing, and troubleshooting.
</div>
</div>
<div class="input-container">
<input type="text" class="chat-input" id="chatInput"
placeholder="Ask me about AWS services...">
<button class="send-button" onclick="sendMessage()">Send</button>
</div>
</div>
<script>
async function sendMessage() {
const message = chatInput.value.trim();
if (!message) return;
addMessage(message, 'user');
chatInput.value = '';
try {
const response = await fetch('https://jnwh6iu2ki.execute-api.us-east-1.amazonaws.com/prod/chat', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
inputTranscript: message,
sessionId: 'web-session-' + Date.now(),
sessionState: { intent: { name: 'GetServiceInfo' } }
})
});
if (response.ok) {
const data = await response.json();
const botResponse = data.messages?.[0]?.content || 'Sorry, I encountered an issue.';
addMessage(botResponse, 'bot');
}
} catch (error) {
addMessage('Connection error. Please try again.', 'bot');
}
}
</script>
</body>
</html>
⚙️ AWS Infrastructure
Purpose: Deployed AWS resources and configuration
# Lambda Function
Function Name: aws-cloud-assistant-chatbot
Runtime: Python 3.9
Handler: chatbot-handler.lambda_handler
Role: aws-cloud-assistant-lambda-role
Memory: 128 MB
Timeout: 3 seconds
# API Gateway
API ID: jnwh6iu2ki
Stage: prod
Endpoint: https://jnwh6iu2ki.execute-api.us-east-1.amazonaws.com/prod/chat
Method: POST /chat
Integration: AWS_PROXY to Lambda
# S3 Bucket
Bucket: rusaiagent1
Website Hosting: Enabled
Index Document: index.html
# CloudFront Distribution
Distribution ID: E2CRYM24VDXR9E
Domain: d2fqnmk7qihna2.cloudfront.net
Origin: rusaiagent1.s3-website-us-east-1.amazonaws.com
Status: Deployed
# IAM Role
Role Name: aws-cloud-assistant-lambda-role
Policies: AWSLambdaBasicExecutionRole
Trust Policy: lambda.amazonaws.com
🎯 Key Features
Chatbot Capabilities:
✅ Enhanced AWS Service Coverage (10 Services)
• **Core Services**: Lambda, EC2, S3, RDS, Aurora, DynamoDB, CloudFront
• **Infrastructure**: VPC, EBS, IAM, CloudWatch
• **Rus's Personality**: Real Solutions Architect experience and tips
✅ Pricing Guidance
• Free tier information
• Pay-as-you-go models
• Reserved instances and spot pricing
• Cost optimization tips
✅ Troubleshooting Help
• EC2 connectivity issues
• S3 access problems
• IAM permission errors
• CloudWatch monitoring
✅ Architecture Recommendations
• Serverless vs container strategies
• High availability patterns
• Security best practices
• Performance optimization
✅ Professional Interface
• Real-time chat experience
• Responsive design
• Quick question buttons
• Typing indicators
📊 Project Metrics
Development & Deployment Stats:
Development Time: 3 hours
Lines of Code: ~800 (Python + HTML/CSS/JS)
AWS Services Used: 5 (Lambda, API Gateway, S3, CloudFront, IAM)
Knowledge Base: 10 AWS services with personalized responses
Personality: Rus - Solutions Architect with real project experience
CORS: Fixed for proper web integration
Response Time: <2 seconds average
Cost: <$5/month (minimal usage)
Architecture Pattern: Serverless
Frontend: Vanilla JavaScript
Backend: Python 3.9
API: REST with JSON
Storage: Stateless (no database)
CDN: Global CloudFront distribution
Deployment Method: AWS CLI
Infrastructure: Manual setup
Monitoring: CloudWatch Logs
Security: IAM roles and policies
🚀 Live Demo
Try the chatbot:
🌐 Live URL: https://d2fqnmk7qihna2.cloudfront.net/
Sample Questions to Try:
• "What is AWS Lambda?" (Get Rus's personal experience)
• "Tell me about VPC" (Security tips from Rus)
• "What is Aurora?" (Performance insights)
• "Explain IAM" (Security warnings from experience)
• "How much does AWS cost?" (Real cost breakdowns)
• "Help me troubleshoot" (Rus's debugging approach)
Features to Test:
✓ Real-time responses
✓ Professional formatting
✓ Quick question buttons
✓ Mobile responsive design
✓ Error handling
✓ Typing indicators