email: admin@example.com password: ChangeMe123!
Cloud Cost Intelligence is a real cloud FinOps service scaffold that can ingest live AWS and GCP billing/resource telemetry, detect cost anomalies with machine learning, and execute selected optimizations through provider APIs.
- Pulls live AWS daily spend from Cost Explorer and EC2 resource state from EC2 and CloudWatch.
- Pulls live GCP billing data from a BigQuery billing export and resource telemetry from Cloud Monitoring and Compute Engine.
- Detects genuine anomalies with
IsolationForestover recent service-level spend history. - Generates actionable recommendations for idle EC2 instances, unattached EBS volumes, and idle GCE instances.
- Exposes a FastAPI control plane for syncing, reviewing anomalies, and executing optimizations.
- Serves a browser dashboard at
/for metrics, anomalies, recommendations, and execution results. - Includes session-based login and role-based access control for dashboard/API access.
- Supports
live,demo, andhybriddata modes so you can show the product without cloud credentials. - Emits structured logs, stores audit history, tracks background job runs, and supports webhook alerting.
- Schedules recurring ingestion and analysis with APScheduler.
This repo now mirrors a lighter version of the target CCM architecture while reusing the same codebase.
Logical control-plane mapping:
UI and Dashboard Servicesapp.mainapp.api.routesapp.api.auth_routesapp/static/*
CCM Managerapp/services/cost_intelligence.pyapp/services/topology.py
Batch Serviceapp/services/batch_service.pyapp/services/ingestion.pyapp/services/anomaly_detection.pyapp/services/recommendations.py
Event Serviceapp/services/audit.pyapp/services/job_monitor.pyapp/services/alerts.py
Cloud Connectorsapp/connectors/aws/client.pyapp/connectors/gcp/client.py
Runtime shape:
control-plane-web: dashboard and API gatewayccm-batch-worker: sync/anomaly/recommendation worker loopccm-scheduler: scheduler process for recurring sync triggers 7 You can inspect the current live mapping throughGET /architecture.
- Create a virtual environment and install dependencies.
python -m venv .venv
.venv\Scripts\Activate.ps1
pip install -e .[dev]- Copy
.env.exampleto.envand fill in your environment settings.
Copy-Item .env.example .envThe default database should live outside OneDrive-backed folders on Windows. A safe example path is already provided in .env.example, and the app now falls back to a temp-directory SQLite database when DATABASE_URL is not set.
- Run the API.
uvicorn app.main:app --reload- Sign in at
/auth/loginwith the bootstrap admin account from your.env.
DATA_MODE=live: use real AWS/GCP data onlyDATA_MODE=demo: use seeded demo data onlyDATA_MODE=hybrid: combine demo and live data
For a product demo with no cloud dependency, start from .env.demo.example.
python -m app.cli runserver --host 127.0.0.1 --port 8000
python -m app.cli sync
python -m app.cli worker --interval 300
python -m app.cli schedulerdocker compose up --buildFiles:
- Dockerfile
- docker-compose.yml
The compose topology now runs:
control-plane-webccm-batch-workerccm-scheduler
- C:\Users\userc\OneDrive\Documents\Playground.env.development.example
- C:\Users\userc\OneDrive\Documents\Playground.env.demo.example
- C:\Users\userc\OneDrive\Documents\Playground.env.production.example
- Structured JSON logs are enabled with
STRUCTURED_LOGS=true - Background job history is available from
GET /job-runs - Audit history is available from
GET /auth/audit-logs - Alerting can be enabled with
ALERTING_ENABLED=trueandALERTING_WEBHOOK_URL - Cloud/API ingestion retries are controlled by
RETRY_ATTEMPTSandRETRY_BASE_DELAY_SECONDS
A starter Render deployment target is included in deploy/render.yaml.
Roles:
viewer: read-only dashboard and API accessoperator: can run syncs and optimization actionsadmin: full operator access plus user management
- Configure credentials that allow:
ce:GetCostAndUsageec2:DescribeInstancesec2:DescribeVolumescloudwatch:GetMetricStatisticsec2:StopInstancesec2:DeleteVolume
- Set
AWS_ENABLED=true,AWS_REGION, and optionallyAWS_ACCOUNT_ID.
- Enable billing export to BigQuery for the target billing account.
- Set
GCP_PROJECT_IDandGCP_BILLING_EXPORT_TABLEusing the fully-qualified table name, for example:my-project.billing_export.gcp_billing_export_v1_123ABC_456DEF_789GHI
- Provide credentials with access to:
- BigQuery read on the billing export dataset
- Cloud Monitoring read
- Compute Engine instance list/stop
- Set
GCP_ENABLED=true.
OPTIMIZATION_DRY_RUN=trueis the default so recommendations are generated without mutating cloud resources.- Use
POST /optimizewithauto_approve=trueto mark recommendations approved. - Use
POST /optimizewithforce_execute=trueonly after validating permissions and expected blast radius.
GET /healthGET /GET /architectureGET /auth/loginPOST /auth/loginPOST /auth/logoutGET /auth/meGET /auth/usersPOST /auth/usersPATCH /auth/users/{user_id}GET /summaryGET /job-runsPOST /syncGET /anomaliesGET /recommendationsPOST /optimize
Example optimization request:
{
"recommendation_ids": [1, 2],
"auto_approve": true,
"force_execute": false
}pytestThis project is wired to real AWS and GCP APIs, but I cannot activate the live integrations from this environment because no cloud credentials or network access were provided in the workspace. Once you add credentials and the GCP billing export table, the /sync and /optimize flows are ready to operate against actual accounts.