Inspiration
As a Cloud Engineer, I have to always manually check the AWS Costs now and then to ensure there are no anomalies or spikes, making sure that we're well within the budget. Even though we can set budgets and forecast alerts, we cannot get a detailed cost report without looking at the cost explorer and this can be tiresome from time to time.
What it does
CostOps AI enables users to chat with a simple UI and get detailed cost reports, identify cost anomalies, get month-to-month cost comparison reports, and schedule cost alerts easily via natural language. This can help anyone from founders to new engineers identify cost anomalies effectively and take necessary actions.
CostOps AI utilizes the Amazon Nova Premier model from Bedrock to analyze cost patterns and prepare a detailed report with:
- Instant Cost Reports: Generate daily, monthly, or resource-level AWS cost breakdowns on-demand
- Smart Comparisons: AI-powered month-to-month variance analysis with actionable insights
- Intelligent Caching: Cache-first architecture that serves instant responses for repeated queries
- Async Processing: Resource-intensive reports are processed asynchronously and emailed when ready
- Scheduled Automation: Set up recurring cost reports with natural language cron expressions
How we built it
Built as a fully serverless solution leveraging Cost Explorer, Lambda, Cognito, DynamoDB, S3, CloudFront, SES, EventBridge, API Gateway, and Bedrock AI. The architecture ensures a cache-first strategy with intelligent cost data retrieval, AI-powered analysis, and professional PDF report generation. All AWS Cost Explorer logic is centralized in reusable utilities, with comprehensive error handling and structured logging throughout.
Challenges we ran into
- Cost Explorer API Complexity: Normalizing different Cost Explorer commands (standard vs resource-level vs comparisons) into a unified utility module
- Intelligent Caching Strategy: Implementing cache keys that account for special requirements and different report types while maintaining performance
- AI Prompt Engineering: Crafting Bedrock prompts that extract meaningful insights from complex Cost Explorer data without AI hallucination
- Async Processing Flow: Coordinating between synchronous API responses and asynchronous resource-level report generation via DynamoDB streams
Accomplishments that we're proud of
- Production-Ready Architecture: Built a scalable, maintainable system with proper separation of concerns
- AI-Powered Insights: Successfully engineered prompts that provide actionable cost analysis, not just data regurgitation
- Performance Optimization: Achieved quick response times for cached reports while handling expensive Cost Explorer queries efficiently
- Developer Experience: Created a modular codebase with centralized utilities that are easy to extend and maintain
What we learned
- The importance of cache-first architecture when dealing with expensive APIs like Cost Explorer
- Advanced prompt engineering techniques for extracting structured insights from complex financial data
- Best practices for error handling and logging in distributed serverless applications
What's next for CostOps AI
- Multi-Account Support: Extend to handle cost analysis across multiple AWS accounts and organizations, possibly using IAM anywhere.
- Cost Optimization Recommendations: AI-powered suggestions for rightsizing and cost reduction opportunities leveraging Cost Optimization Hub and Savings plans.
- Integration Ecosystem: Add Slack/Teams integrations and webhook support for enterprise workflows
- Advanced Analytics: Historical trend analysis and predictive cost forecasting capabilities
Built With
- amazon-cloudfront-cdn
- amazon-dynamodb
- amazon-ses
- bedrock
- cdk
- cognito
- cost-explorer
- eventbridge
- lambda
- node.js
- rest-api
- s3

Log in or sign up for Devpost to join the conversation.