Production-ready ML pipeline for customer segmentation using AWS services, Infrastructure as Code, and GenAI integration. Features automatic scaling, cost optimization, and one-command deployment.
# Deploy complete infrastructure with auto-scaling
make install && make deploy
# Environment-specific deployments
make deploy-dev # Development (1-2 instances)
make deploy-prod # Production (2-8 instances)
# Test the APIs
make test-api # Test GenAI insights
make test-sagemaker # Test ML segmentation
- Auto-Scaling SageMaker Endpoints: 1-4 instances, target-tracking scaling
- Customer Segmentation: K-means clustering (0.62 silhouette score, 150ms inference)
- GenAI Insights: AWS Bedrock Claude-3-Haiku (1.6-2.7s response, multi-language)
- Infrastructure as Code: Complete CloudFormation automation
- Cost Optimized: Auto-scaling + manual notebook controls
Task | Implementation | Performance |
---|---|---|
1. Customer Segmentation | K-means clustering, auto-scaling 1-4 instances | 150ms inference, 0.62 silhouette score |
2. Infrastructure as Code | CloudFormation with auto-scaling, security, cost controls | One-command deployment |
3. GenAI Customer Insights | AWS Bedrock Claude-3-Haiku, multi-language support | 1.6-2.7s response, 90% confidence |
📖 Detailed Documentation: notebooks/ • src/README.md • docs/architecture.md
# Get your API URLs
make get-api-url # GenAI insights endpoint
make get-sagemaker-api-url # ML segmentation endpoint
# Test the APIs
make test-api # Test GenAI with sample data
make test-sagemaker # Test ML clustering with sample data
Example Usage: See src/README.md for detailed API documentation and examples.
- AWS Account with CLI configured (
aws configure
) - Python 3.9+
- GitHub Personal Access Token (for SageMaker integration)
git clone <repository-url> && cd ml-pipeline
make install && make deploy
make deploy-dev # Development: 1-2 instances, cost-optimized
make deploy-prod # Production: 2-8 instances, high availability
make deploy-custom # Interactive: custom scaling parameters
make get-scaling # Check auto-scaling status
make get-endpoints # List endpoints with instance counts
make start-notebook # Start SageMaker notebook
make stop-notebook # Stop notebook (cost savings)
make destroy # Clean up all resources
- Auto-Scaling: SageMaker endpoints (1-4 instances) with target-tracking
- Cost Optimization: Auto scale-down + manual notebook controls
- Security: IAM least privilege, S3 encryption, API Gateway CORS
- Monitoring: CloudWatch logs, scaling metrics, performance tracking
Troubleshooting: See TROUBLESHOOTING.md • Quick fix: make force-destroy
for cleanup
Metric | Target | Achieved | Status |
---|---|---|---|
SageMaker Latency | < 200ms | ~150ms | ✅ 25% better |
GenAI Response | < 3s | 1.6-2.7s | ✅ Sub-3s met |
Model Accuracy | > 0.5 | 0.62 | ✅ 24% above |
Auto-Scaling | - | 1-4 instances, 60s scale-out | ✅ Production-ready |
ml-pipeline/
├── infrastructure/cloudformation-complete.yaml # Complete IaC with auto-scaling
├── src/genai/ # GenAI Lambda functions
├── notebooks/CustomerSegmentation.ipynb # ML model development
├── data/customer_segmentation_data.csv # Dataset (1000 customers)
├── docs/ # Architecture documentation
└── Makefile # Deployment automation
- Architecture: docs/architecture.md
- API Documentation: src/README.md
- Troubleshooting: TROUBLESHOOTING.md
- Notebooks: notebooks/README.md