A complete Alexa skill that integrates with AWS Bedrock (Claude 3 Haiku) through a Spring Boot backend deployed on Elastic Beanstalk.
๐ Learning Project: This entire project was created using Cursor IDE and AWS Bedrock to explore modern AI-powered development tools. Every line of code, configuration, test, and documentation was generated with AI assistance through Cursor, demonstrating the power of AI-driven development while learning AWS Bedrock integration patterns.
- Voice Interaction: Ask questions through any Alexa device
- AI Processing: Powered by Claude 3 Haiku via AWS Bedrock
- Scalable Backend: Spring Boot on Elastic Beanstalk
- Cost Protection: Automatic service cutoff to prevent unexpected bills
- Security: API key authentication between components
- Enterprise Testing: Comprehensive test suite with CI/CD pipeline
The following diagram shows the complete end-to-end flow from voice command to AI response:
graph TB
subgraph "User Interaction"
A[๐ฃ๏ธ Alexa Device] --> B["Voice: 'Alexa, ask my ai what is Database?'"]
end
subgraph "AWS Lambda Layer"
B --> C[๐ต Alexa Skill Lambda Function]
C --> |"HTTP POST + API Key"| D[Backend Request]
D --> |"JSON: {message: 'what is Database'}"| E[Spring Boot Backend]
end
subgraph "Elastic Beanstalk Environment"
E[๐ Spring Boot Backend<br/>Port 5000<br/>Corretto 17] --> F[API Key Validation]
F --> |"Valid Key"| G[Input Validation]
F --> |"Invalid Key"| H[โ 401 Unauthorized]
G --> |"Valid Input"| I[Bedrock API Call]
G --> |"Invalid Input"| J[โ 400 Bad Request]
end
subgraph "AWS Bedrock"
I --> K[๐ค Claude 3 Haiku<br/>anthropic.claude-3-haiku-20240307-v1:0]
K --> L["AI Response:<br/>'A database is a structured collection<br/>of data stored electronically...'"]
end
subgraph "Response Flow"
L --> M[JSON Response]
M --> |"HTTP 200"| N[Lambda Processing]
N --> O[Alexa Response]
O --> P[๐ฃ๏ธ Voice Output to User]
end
subgraph "Cost Protection System"
Q[๐ฐ CloudWatch Alarms<br/>$10, $25, $40 thresholds] --> R[๐ง SNS Notifications<br/>Email Alerts]
R --> |"$40 Threshold"| S[๐จ Budget Cutoff Lambda<br/>Auto-terminate services]
S --> T[๐ Service Shutdown<br/>EB Environment + Lambda]
end
subgraph "Security & Configuration"
U[๐ API Key Authentication<br/>Alexa โ Backend]
V[๐ Environment Variables<br/>AWS_REGION, BEDROCK_MODEL_ID]
W[โ๏ธ IAM Roles<br/>EC2 โ Bedrock permissions]
end
subgraph "Development & Testing"
X[๐งช Comprehensive Test Suite<br/>Unit + Integration + E2E]
Y[๐ CI/CD Pipeline<br/>GitHub Actions]
Z[๐ Monitoring<br/>CloudWatch + Health Checks]
end
style A fill:#e1f5fe
style C fill:#f3e5f5
style E fill:#e8f5e8
style K fill:#fff3e0
style Q fill:#ffebee
style U fill:#f1f8e9
style X fill:#e3f2fd
| Component | Technology | Purpose |
|---|---|---|
| Alexa Device | Amazon Echo/Dot | Voice interface for user interaction |
| Alexa Skill | Node.js Lambda | Processes voice commands and responses |
| Backend API | Spring Boot | Handles business logic and Bedrock integration |
| AI Engine | AWS Bedrock (Claude 3 Haiku) | Generates intelligent responses |
| Infrastructure | Elastic Beanstalk | Scalable hosting for backend service |
| Cost Protection | CloudWatch + Lambda | Automatic cost control and service cutoff |
| Security | API Keys + IAM | Authentication and authorization |
| Testing | JUnit + Mocha + Integration | Comprehensive quality assurance |
- AWS Account with appropriate permissions
- AWS CLI configured
- Java 17+, Maven 3.6+, Node.js 18+
- EB CLI installed
git clone <your-repo>
cd alexa-chatgpt-java
# Install prerequisites
./install-prerequisites.sh
# Automated setup (recommended)
./setup-environment.sh
# OR Manual setup
cp environment-variables.template .env
cp alexa-skill-nodejs/lambda-env.template alexa-skill-nodejs/.env
cp java-backend-springboot/.ebextensions/01-port.config.template java-backend-springboot/.ebextensions/01-port.config
# Edit the files above with your specific AWS account detailscd java-backend-springboot
eb init # Choose your region and platform
eb create # Create environment
eb deploy # Deploy applicationcd alexa-skill-nodejs
npm install
./deploy-lambda.sh # Follow the script instructions- Go to Alexa Developer Console
- Create new skill using
skill-package/skill.json - Update Lambda ARN with your function ARN
- Test and publish
Includes comprehensive cost protection:
- $10 Threshold: Early warning email
- $25 Threshold: Budget alert email
- $40 Threshold: Automatic service termination
Deploy cost protection:
# Update budget-cutoff-lambda.py with your service names
./deploy-cost-protection.shAWS_REGION: Your AWS region (e.g., eu-central-1)AWS_ACCOUNT_ID: Your 12-digit AWS account IDALEXA_API_KEY: Generated API key for authenticationBACKEND_HOST: Your Elastic Beanstalk URLBEDROCK_MODEL_ID: anthropic.claude-3-haiku-20240307-v1:0
environment-variables.templateโ Copy to.envalexa-skill-nodejs/lambda-env.templateโ Copy toalexa-skill-nodejs/.envjava-backend-springboot/.ebextensions/01-port.config.templateโ Copy and configure
curl -X POST http://YOUR_EB_URL/chat \
-H 'Content-Type: application/json' \
-H 'x-api-key: YOUR_API_KEY' \
-d '{"message": "Hello, what is AI?"}'"Alexa, ask my ai what is artificial intelligence?"
- Elastic Beanstalk (t3.micro): ~$8-15/month
- Lambda: ~$0.50/month (1000 requests)
- Bedrock (Claude 3 Haiku): ~$0.25 per 1M tokens
- Total: ~$10-20/month for moderate usage
- API key authentication between Alexa and backend
- IAM roles with minimal required permissions
- Input validation and sanitization
- VPC deployment ready (optional)
SETUP.md- Detailed setup instructionsSECURITY.md- Security considerationsCOST_OPTIMIZATION.md- Cost optimization strategiesTESTING_GUIDE.md- Comprehensive testing guideAWS_USER_PERMISSIONS.md- Required AWS permissions
| Issue | Solution |
|---|---|
| EB CLI not found | brew install aws-elasticbeanstalk |
| Bedrock access denied | Request access in AWS Console |
| Lambda timeout | Increase timeout in configuration |
| API key errors | Check environment variables |
# Check deployment status
eb status
eb logs
# Test Lambda function
aws lambda invoke --function-name YOUR_FUNCTION_NAME test-output.json
# Monitor costs
aws budgets describe-budgets --account-id YOUR_ACCOUNT_ID- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Never commit sensitive information (API keys, account IDs, emails)
- Always use environment variables for configuration
- Test in development before deploying to production
- Monitor costs regularly using AWS Cost Explorer
- Keep dependencies updated for security patches
This project is licensed under the MIT License - see the LICENSE file for details.
- โ Voice-activated AI assistant
- โ AWS Bedrock integration (Claude 3 Haiku)
- โ Scalable Spring Boot backend
- โ Automatic cost protection
- โ Security with API keys
- โ Comprehensive monitoring
- โ Easy deployment scripts
- โ Production-ready configuration
- Multi-turn conversations with context
- Different AI models based on query complexity
- Web interface for testing
- Integration with other voice assistants
- Advanced analytics and usage tracking
This project represents a comprehensive exploration of modern AI-powered development tools and cloud services:
This entire codebase was built using Cursor IDE, showcasing its capabilities for:
- ๐ค AI-Assisted Development: Leveraged Cursor's AI features for code generation, debugging, and optimization
- ๐ง Intelligent Code Completion: Used AI suggestions for complex AWS integrations and Spring Boot configurations
- ๐ Context-Aware Assistance: Benefited from Cursor's understanding of the project structure for consistent code patterns
- โก Rapid Prototyping: Accelerated development through AI-powered code generation and refactoring
- ๐ Smart Debugging: Utilized AI assistance for troubleshooting deployment issues and configuration problems
- ๐ Documentation Generation: Leveraged AI for creating comprehensive documentation and README content
The project served as a hands-on exploration of AWS Bedrock capabilities:
- ๐ค Claude 3 Haiku Integration: Implemented direct API calls to Anthropic's Claude model through Bedrock
- ๐ง SDK Configuration: Learned AWS SDK setup and configuration for Bedrock services
- ๐ Regional Deployment: Configured services in eu-central-1 region for optimal performance
- ๐ฐ Cost Management: Implemented comprehensive cost controls and monitoring for Bedrock usage
- ๐ Security Best Practices: Applied proper IAM roles and API key management for Bedrock access
- โก Performance Optimization: Optimized request patterns and response handling for Claude interactions
Through this learning project, the following technologies were explored:
| Category | Technologies Learned |
|---|---|
| AI Development | Cursor IDE, AWS Bedrock, Claude 3 Haiku API |
| Backend Development | Spring Boot, Java 17, Maven, REST APIs |
| Cloud Infrastructure | AWS Elastic Beanstalk, Lambda, CloudWatch, SNS |
| Voice Technology | Amazon Alexa Skills Kit, Voice User Interface design |
| DevOps & Testing | GitHub Actions, JUnit, Integration testing, CI/CD |
| Security | API key management, IAM roles, Cost protection |
| Monitoring | CloudWatch alarms, SNS notifications, Health checks |
- ๐ Modern IDE Capabilities: Experienced the power of AI-assisted development with Cursor
- โ๏ธ Cloud-Native Architecture: Built a production-ready, scalable cloud application
- ๐ค AI Service Integration: Successfully integrated enterprise AI services (Bedrock) into applications
- ๐ฃ๏ธ Voice Interface Development: Created a functional voice-activated AI assistant
- ๐ Security-First Approach: Implemented comprehensive security and cost controls
- ๐งช Test-Driven Development: Built enterprise-grade testing and CI/CD pipelines
- ๐ Production Monitoring: Set up comprehensive monitoring and alerting systems
What Worked Well:
- Cursor's AI assistance accelerated development by ~3-4x
- AWS Bedrock provided reliable, high-quality AI responses
- Spring Boot offered excellent AWS SDK integration
- Comprehensive testing prevented deployment issues
Challenges Overcome:
- Complex AWS IAM permission configurations
- Alexa skill deployment and testing workflows
- Cost management and automatic service cutoffs
- Multi-service integration and error handling
Best Practices Discovered:
- Environment variable management for multi-service applications
- API key rotation and security patterns
- Cost monitoring and automatic protection mechanisms
- Comprehensive testing strategies for cloud applications
This learning project demonstrates:
- Production-Ready Code: Enterprise-grade application with full testing and CI/CD
- Modern Development Practices: AI-assisted development with proper DevOps workflows
- Cloud-Native Design: Scalable, secure, and cost-effective cloud architecture
- Real-World Application: Functional voice assistant that actually works on physical Alexa devices
Perfect example of how modern AI development tools can accelerate learning and building complex, production-ready applications! ๐
Ready to deploy your own AI-powered Alexa skill? Follow the setup guide and start building! ๐