Cloud Cost API

The Cloud Cost API provides multiple endpoints to obtain accurate cost information from your cloud service providers (CSPs), including data available from cloud billing reports (such as AWS' Cost and Usage Report (CUR)).

Cloud Cost querying API

GET http://<your-kubecost-address>/model/cloudCost

Samples full granularity of cloud costs from cloud billing report (ex. AWS' Cost and Usage Report)

Path Parameters

{
    "code": 200,
    "data": {
        "sets": [
            {
                "cloudCosts": {
                    "": {
                        "properties": {
                            "provider": ""
                        },
                        "window": {
                            "start": "",
                            "end": ""
                        },
                        "listCost": {
                            "cost": ,
                            "kubernetesPercent": 
                        },
                        "netCost": {
                            "cost": ,
                            "kubernetesPercent": 
                        },
                        "amortizedNetCost": {
                            "cost": ,
                            "kubernetesPercent":
                        },
                        "invoicedCost": {
                            "cost": ,
                            "kubernetesPercent": 
                        },
                        "amortizedCost": {
                            "cost": ,
                            "kubernetesPercent": 
                        }
                    },
                },
                "window": {
                    "start": "",
                    "end": ""
                },
            }
        ],
        "window": {
            "start": "",
            "end": ""
        }
    }
}

Schema overview

Cloud cost metrics

Cloud cost metric types values are based on and calculated following standard FinOps dimensions and metrics. The five types of cloud cost metrics provided by the Cloud Cost API are:

See our Cloud Cost Metrics doc to learn more about these cost metric types and how they are calculated.

kubernetesPercent

Each cost metric also has a kubernetesPercent value. Unaggregated, this value will be 0 or 1. When you aggregate, kubernetesPercent is determined by multiplying the cost metric cost by its kubernetesPercent and aggregating that value as kubernetesCost for that cost metric. That kubernetesCost is then divided by the aggregated total costs to determine the new kubernetesPercent. Since this process results in unique values for each cost metric, this value is included as part of the cost metric.

Examples

Query for cloud net costs within the past two days, aggregated by accounts, filtered only for Amazon EC2 costs

http:/<your-kubecost-address>/model/cloudCost?window=2d&aggregate=invoiceEntityID&filter=service:"AmazonEC2"

Last updated