-
Notifications
You must be signed in to change notification settings - Fork 5
Home
Mubendiran K edited this page Jun 4, 2026
·
1 revision
Cloud Insight AI is an AWS cost + log analysis toolkit that can be used as a Python library or paired with the static dashboard UI.
What you get
- Cost analysis with per-service breakdowns and trends
- Log analysis with error/warning summaries and patterns
- Optional dashboard UI that renders JSON reports
Repo highlights
-
src/cloud_insight_ai/— library code -
data/— sample cost and log data -
examples/— usage examples -
tests/— test suite -
index.html,style.css,script.js— dashboard assets
Getting-Started
- Python 3.8+
pip install cloud-insight-ai
Quick start (library)
from cloud_insight_ai import CloudAnalyzer
cost_data = [
{'service': 'EC2', 'date': '2025-01-01', 'cost': 150.25},
{'service': 'S3', 'date': '2025-01-01', 'cost': 45.50},
]
logs = [
'2025-01-01 10:00:00 [INFO] Application started',
'2025-01-01 10:05:30 [ERROR] Connection timeout',
]
analyzer = CloudAnalyzer()
result = analyzer.run(cost_data, logs)
print(f"Total cost: ${result['summary']['total_cost']:.2f}")
print(f"Errors: {result['summary']['error_count']}")
From source
Dependencies are defined in pyproject.toml.
pip install -e .
### Library-API
```markdown
# Library API
## CloudAnalyzer
```python
from cloud_insight_ai import CloudAnalyzer
config = {
'cost_thresholds': {
'high_cost_service_percent': 30.0
},
'log_thresholds': {
'max_error_count': 15,
'max_warning_count': 25
},
'error_patterns': [
{'name': 'Connection Issues', 'keywords': ['connection', 'timeout']}
]
}
analyzer = CloudAnalyzer(config=config)
result = analyzer.run(cost_data, logs)
analyze_cost
from cloud_insight_ai import analyze_cost
cost_result = analyze_cost(cost_data)
Input format
[
{'service': 'EC2', 'date': '2025-01-01', 'cost': 150.25},
{'service': 'S3', 'date': '2025-01-01', 'cost': 45.50},
]
analyze_logs
from cloud_insight_ai import analyze_logs
log_result = analyze_logs(logs)
Input format
[
'2025-01-01 10:00:00 [INFO] Application started',
'2025-01-01 10:05:30 [ERROR] Connection timeout',
]
### Dashboard
```markdown
# Dashboard
The dashboard is a static site that fetches a JSON report and renders charts.
## Files
- `index.html` (inline JS)
- `style.css`
- `script.js` (alternate JS implementation)
## Data source
The UI expects a JSON report at a URL:
- `index.html` uses: `const S3_URL = '.../final_report.json'`
- `script.js` uses: `const S3_REPORT_URL = '.../final_report.json'`
Update the constant to point at your hosted JSON.
## Hosting
You can host the dashboard on any static host (S3 static website, GitHub Pages, etc.).
Ensure the JSON file is publicly readable and CORS-enabled.
## Expected JSON fields (high-level)
The UI reads fields like:
- `timestamp`
- `cost_breakdown[]` (service, cost, percentage, trend, change_percent, recommendation)
- `cost_trend.history[]` (date, cost)
- `log_levels` / `error_details` / `warning_details` / `info_details`
- `ai_insights[]`
Configuration
# Configuration
## Library configuration (CloudAnalyzer)
```python
config = {
'cost_thresholds': {'high_cost_service_percent': 30.0},
'log_thresholds': {'max_error_count': 15, 'max_warning_count': 25},
'error_patterns': [
{'name': 'Connection Issues', 'keywords': ['connection', 'timeout']}
]
}
Environment variables
Used by configuration helpers in src/cloud_insight_ai/config.py:
- DEBUG (true/false)
- ENV (development or production)
- AWS_REGION
- S3_BUCKET
config.yaml (reference)
The repository includes config.yaml showing a full configuration for:
- cost/log thresholds
- log sources
- Comprehend settings
- notifications
- storage settings
### Development
```markdown
# Development
## Install dev dependencies
```bash
pip install -e ".[dev]"
Run tests
pytest
Formatting & typing (optional)
black .
flake8
mypy src