Cost Analysis & Reports
The Cost Explorer provides methods for analyzing infrastructure costs, workflow execution costs, and combined cost views. All cost data flows through the backend service which integrates with AWS Cost Explorer, and is cached for fast access to minimize API calls.
Cost Data Sources
Cost data is aggregated from two primary sources:
| Source | Description |
|---|---|
| Infrastructure costs | AWS Cost Explorer data covering EC2, RDS, S3, EKS, and other AWS services |
| Execution costs | Workflow execution costs tracked by the platform's workflow engine |
The combined costs view merges both sources for a complete picture of platform spending.
Cost Explorer Methods
All Cost Explorer methods require admin role access. Data is served from cache when available, with fallback to the backend API for fresh data.
Get All Cached Data
Retrieve all cached cost data in a single call:
costExplorer.getAllData(months = 12)
Returns a combined object with all available cached data:
| Field | Description |
|---|---|
monthlyCosts | Monthly cost breakdown by service |
dailyCosts | Daily cost breakdown |
predictions | ML-based cost forecasts |
serviceBreakdown | Cost distribution across AWS services |
anomalies | Detected cost anomalies |
The method first checks for typed cache documents (monthly, daily, predictions, service_breakdown, anomalies) and falls back to legacy aws-costs cache entries for backward compatibility.
Monthly Costs
costExplorer.getMonthlyCosts(months = 12)
| Parameter | Default | Description |
|---|---|---|
months | 12 | Number of months of history to return |
Returns monthly cost breakdown by service, fetched from the backend endpoint GET /api/v1/finops/monthly-costs.
Daily Costs
costExplorer.getDailyCosts(days = 30)
| Parameter | Default | Description |
|---|---|---|
days | 30 | Number of days of history to return |
Returns granular daily spending data, fetched from the backend endpoint GET /api/v1/finops/daily-costs.
Cost Forecast
costExplorer.getCostForecast(monthsAhead = 3)
| Parameter | Default | Description |
|---|---|---|
monthsAhead | 3 | Number of months to forecast |
Returns ML-based cost predictions with confidence intervals, fetched from the backend endpoint GET /api/v1/finops/cost-forecast.
Service Breakdown
costExplorer.getServiceBreakdown(startDate, endDate)
| Parameter | Description |
|---|---|
startDate | Start date for the breakdown period (string) |
endDate | End date for the breakdown period (string) |
Returns cost distribution across AWS services for the specified date range, fetched from the backend endpoint GET /api/v1/finops/service-breakdown.
Savings Recommendations
costExplorer.getSavingsRecommendations()
Returns AWS optimization recommendations from the backend endpoint GET /api/v1/finops/savings-recommendations. These recommendations are generated by AWS and may include right-sizing suggestions, reserved instance recommendations, and unused resource identification.
Cost Anomalies
costExplorer.getCostAnomalies()
Returns detected cost anomalies from the backend endpoint GET /api/v1/finops/cost-anomalies. Anomalies are statistically identified cost spikes that deviate from normal spending patterns.
Execution Costs
costExplorer.getExecutionCosts(months = 12, year = null)
| Parameter | Default | Description |
|---|---|---|
months | 12 | Number of months of history |
year | null | Optional specific year to query |
Returns workflow execution cost tracking data from the backend endpoint GET /api/v1/finops/execution-costs. This covers costs directly associated with running workflows on the platform.
Combined Costs
costExplorer.getCombinedCosts(months = 12)
| Parameter | Default | Description |
|---|---|---|
months | 12 | Number of months of history |
Returns infrastructure costs combined with execution costs from the backend endpoint GET /api/v1/finops/combined-costs. This provides the most complete view of total platform spending.
Cache Management
Cost data is cached for fast access to minimize AWS API calls. Each cache entry has a type field identifying the data category and a data field containing the cached response.
Cache Types
| Cache Type | Description |
|---|---|
monthly | Monthly cost data, keyed by timeRange |
daily | Daily cost data, keyed by timeRange |
predictions | Cost forecast data |
service_breakdown | Service-level cost breakdown |
anomalies | Detected cost anomalies |
aws-costs | Legacy combined cache entry (backward compatibility) |
Triggering a Cache Refresh
costExplorer.triggerCacheRefresh()
This method triggers a background cache refresh via the backend API endpoint POST /api/v1/finops/cache/trigger-refresh. The refresh is fire-and-forget -- the method returns immediately while the backend processes the refresh asynchronously.
Returns:
{
"success": true,
"message": "Cache refresh triggered in background"
}
Refreshing via the UI
- Navigate to the FinOps dashboard
- Click the Refresh button
- The system triggers a background cache refresh
- New data appears on the dashboard once the refresh completes
Analyzing Cost Data
Monthly Cost Trends
The monthly costs view shows:
- Total cost per month broken down by AWS service
- Month-over-month percentage changes
- Top services contributing to costs
- Historical spending patterns over the selected time range
Daily Cost Breakdown
The daily costs view provides:
- Granular day-by-day spending
- Day-of-week patterns
- Identification of cost spikes on specific dates
- Short-term trend analysis
Service-Level Analysis
The service breakdown shows cost distribution across AWS services for a custom date range:
- Per-service cost totals
- Percentage of total spend per service
- Comparison between current and previous period
- Identification of the most expensive services
Cost Forecasting
The ML-based cost forecast provides:
- Projected costs for the next 1-3 months
- Confidence intervals (upper and lower bounds)
- Trend direction and magnitude
- Comparison of projected versus budgeted amounts
Cost Anomalies
Anomaly detection identifies unusual cost patterns:
- Date and duration of each anomaly
- Which AWS service caused the anomaly
- Expected versus actual cost
- Dollar magnitude of the deviation
Combining Infrastructure and Execution Costs
The combined costs view merges AWS infrastructure costs with workflow execution costs to provide full visibility into platform spending. This is particularly useful for:
- Understanding the total cost of running workflows (infrastructure + compute)
- Identifying whether cost increases are driven by infrastructure or execution volume
- Planning capacity based on both infrastructure and workload trends
Backend API Endpoints
The platform proxies all cost requests to the backend:
| Endpoint | Method | Description |
|---|---|---|
/api/v1/finops/monthly-costs | GET | Monthly cost breakdown by service |
/api/v1/finops/daily-costs | GET | Daily cost breakdown |
/api/v1/finops/cost-forecast | GET | ML-based cost predictions |
/api/v1/finops/service-breakdown | GET | Service-level cost breakdown for a date range |
/api/v1/finops/savings-recommendations | GET | AWS optimization recommendations |
/api/v1/finops/cost-anomalies | GET | Detected cost anomalies |
/api/v1/finops/execution-costs | GET | Workflow execution cost tracking |
/api/v1/finops/combined-costs | GET | Combined infrastructure + execution costs |
/api/v1/finops/cache/trigger-refresh | POST | Trigger background cache refresh |
The backend URL is configured during platform deployment.
Best Practices
Review Costs Regularly
- Check the cost dashboard weekly to identify trends
- Review daily costs when investigating anomalies
- Use the service breakdown to find the most expensive services
Use Forecasting for Planning
- Compare forecasts against budget allocations
- Investigate discrepancies between predicted and actual costs
- Use forecast confidence intervals when setting budget thresholds
Monitor Anomalies Proactively
- Investigate all cost anomalies promptly
- Determine whether anomalies are caused by expected events (deployments, scaling) or unexpected issues
- Set budget alerts at appropriate thresholds based on historical anomaly patterns
Refresh Cache Appropriately
- Cost data is cached to minimize AWS API costs
- Refresh the cache when you need current data for decision-making
- Avoid excessive refreshes as each triggers AWS Cost Explorer API calls
Use the costExplorer.getAllData method to fetch all cached cost data in a single call. This is more efficient than making separate calls for each data type and provides a complete snapshot for dashboard rendering.