When ingesting billing data from cloud service providers (CSP), Kubecost records multiple cost metrics for each item. These cost metrics represent different pricing models which may be useful depending on what needs to be accomplished. The cost metrics currently supported by Cloud Cost are:
ListCost
NetCost
AmortizedNetCost
InvoicedCost
AmortizedCost
Each cost metric includes a Cost
and a KubernetesPercent
field. An unaggregated CloudCost query should have a 1
or a 0
in the KubernetesPercent
field of all of its cost metrics. When it becomes aggregated, this value can become a percentage. It is necessary to keep track of these separately because differences in cost metrics will cause this value to diverge. For example, aggregating a Cloud Cost representing a Kubernetes node that has a reserved instance applied to it, and a non-Kubernetes node of the same type but with no reserved instance discount. See below:
Node1 {
ListCost: {
Cost: 2,
KubernetesPercent: 1.0,
},
AmortizedNetCost: {
Cost: 1,
KubernetesPercent: 1.0
},
}
Node2 {
ListCost: {
Cost: 2,
KubernetesPercent: 0.0,
},
AmortizedNetCost: {
Cost: 2,
KubernetesPercent: 0.0
},
}
agg {
ListCost: {
Cost: 4,
KubernetesPercent: 0.5,
},
AmortizedNetCost: {
Cost: 3,
KubernetesPercent: 0.33
},
}
The KubernetesPercent
on the AmortizedNetCost is calculated at 33% from $1 which was 100% Kubernetes spend and $2 that were 0% Kubernetes spend in that dimension.
The current Cloud Cost schema is optimistic in that it provides space for cost metrics that may not yet be available from some providers. As the FOCUS Spec gains more adoption among CSPs, all fields will be populated with values that match the definitions. For now, some values on certain providers are being populated with their nearest approximate. This section outlines how each value is populated on each CSP.
Of all billing exports and APIs, the Cost and Usage Report (CUR) has the most robust set of cost metrics, and currently has the best support. Depending on what kind of discounts or resources a user has, the schema changes, therefore many of these columns are populated dynamically to support all users. In particular, any _net_
column will only be available if the user has a discount that causes it to exist. Additionally, Kubecost currently only considers line items that have a line_item_line_item_type
of Usage
, DiscountUsage
, SavingsPlanCoveredUsage
, EdpDiscount
, or PrivateRateDiscount
.
More information on the columns and their definitions can be found in AWS' Line item details documentation.
List Cost
To populate list price, Kubecost uses pricing_public_on_demand_cost
.
Net Cost
Kubecost uses line_item_net_unblended_cost
if available. If not, Kubecost uses line_item_unblended_cost.
Amortized Net Cost
If _net_
is not available, Kubecost uses Amortized Cost
If line_item_line_item_type
is DiscountUsage
, Kubecost uses reservation_net_effective_cost
.
If line_item_line_item_type
is SavingsPlanCoveredUsage
, Kubecost uses savings_plan_net_savings_plan_effective_cost
.
Default to line_item_net_unblended_cost
.
Invoiced Cost
Kubecost uses Net Cost.
Amortized Cost
If line_item_line_item_type
is DiscountUsage
, Kubecost uses reservation_effective_cost
.
If line_item_line_item_type
is SavingsPlanCoveredUsage
, Kubecost uses savings_plan_savings_plan_effective_cost
.
Default to line_item_unblended_cost
.
Cloud Cost uses a detailed billing export accessed via BigQuery to interface with GCP. This export provides Kubecost with a Cost column with a float value in addition to an array of credit objects per item. These credits are various discounts applied to the item being referenced.
More details about the export can be found in GCP's Structure of Detailed data export.
List Cost
The Cost column for the line item.
Net Cost
The Cost column plus the sum of all credit amounts.
Amortized Net Cost
Kubecost uses Net Cost.
Invoiced Cost
Kubecost uses Net Cost.
Amortized Cost
Kubecost uses Net Cost.
The Azure billing export can be set to amortized or not amortized during creation. Depending on this, either the Net Cost Metric or Amortized Net Cost metric will be accurate. Additionally the Azure export has multiple schema depending on when it was created and what kind of account the user has. There are also localized versions of the headers.
List Cost
Kubecost usespaygcostinbillingcurrency
if available, otherwise Kubecost uses Net Cost
Net Cost
Kubecost uses costinbillingcurrency
. If not available, Kubecost uses pretaxcost
, and if that isn't available, Kubecost uses cost
.
Amortized Net Cost
Kubecost uses Net Cost.
Invoiced Cost
Kubecost uses Net Cost.
Amortized Cost
Kubecost uses Net Cost.
To calculate the 'K8s Utilization', Kubecost must first determine if a resources is part of a Kubernetes cluster or not.
If a tag or label in the list below is present on the billing export, Kubecost will consider those costs part of the 'K8s Utilization' calculation. This will not always be 100% accurate in all situations.
In AWS, Kubecost will identify the line item in the bill as a Kubernetes resource if line_item_product_code
is AmazonEKS
, or one of the following label keys is present:
resource_tags_aws_eks_cluster_name
resource_tags_user_eks_cluster_name
resource_tags_user_alpha_eksctl_io_cluster_name
resource_tags_user_kubernetes_io_service_name
resource_tags_user_kubernetes_io_created_for_pvc_name
resource_tags_user_kubernetes_io_created_for_pv_name
The Cloud Cost API cannot be used until you have enabled Cloud Cost via Helm. See Kubecost's Cloud Cost Explorer doc for instructions.
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)).
There are three distinct endpoints for using the Cloud Cost API. The default endpoint for querying Cloud Costs should be /model/cloudCost/view
.
GET
http://<your-kubecost-address>/model/cloudCost/view
Samples full granularity of cloud costs from cloud billing report (ex. AWS' Cost and Usage Report)
window*
String
Window of the query. Only accepts daily intervals, example window=3d
.
costMetric
String
Determines which cloud cost metric type will be returned. Acceptable values are AmortizedNetCost
, InvoicedCost
, ListCost
, and NetCost
. Default is AmortizedNetCost
.
aggregate
String
Field by which to aggregate the results. Accepts: invoiceEntityID
, accountID
, provider
, service
, and label:<name>
. Supports multi-aggregation using comma-separated lists. Example: aggregate=accountID,service
filterInvoiceEntityIDs
String
Filter for account
filterAccountIDs
String
GCP only, filter for projectID
filterProviders
String
Filter for cloud service provider
filterProvidersID
String
Filter for resource-level ID given by CSP
filterServices
String
Filter for cloud service
filterCategories
String
Filter based on object type
filterLabels
String
Filter for a specific label. Does not support filtering for multiple labels at once.
{
"code": 200,
"data": {
"graphData": [
{
"start": "",
"end": "",
"items": []
}
],
"tableTotal": {
"name": "",
"kubernetesPercent": 0,
"cost": 0
},
"tableRows": []
}
}
The endpoint /model/cloudCost/top
will use all parameters of /model/cloudCost/view
listed above, except for CostMetric
. This is because /top
samples full granularity from your cloud billing reports and will return information for all four accepted metric types (see below for more information on these types).
The endpoint /view
contains all parameters for /model/CloudCost/aggregate
, and if your /view
query parameters are in a subset of /aggregate
, your payload will be pulled from /aggregate
instead (this payload will return a larger amount of information than /view
). Otherwise, your /view
query will pull from /top
.
GET
http://<your-kubecost-address>/model/cloudCost/aggregate
Query cloud cost aggregate data
window*
string
aggregate
string
Field by which to aggregate the results. Accepts: invoiceEntityID
, accountID
, provider
, service
, and label:<name>
. Supports multi-aggregation using comma-separated lists. Example: aggregate=accountID,service
filterInvoiceEntityIDs
string
Filter for account
filterAccountIDs
string
GCP only, filter for projectID
filterProviders
string
Filter for cloud service provider
filterServices
string
Filter for cloud service
filterLabel
String
Filter for a specific label. Does not support filtering for multiple labels at once.
```json
{
"code": 200,
"data": {
"sets": [
{
"cloudCosts": {
"": {
"properties": {
"provider": "",
"invoiceEntityID": ""
},
"window": {
"start": "",
"end": ""
},
"listCost": {
"cost": ,
"kubernetesPercent":
},
"netCost": {
"cost": ,
"kubernetesPercent":
},
"amortizedNetCost": {
"cost": 5,
"kubernetesPercent":
},
"invoicedCost": {
"cost": ,
"kubernetesPercent":
}
}
},
"window": {
"start": "",
"end": ""
},
"aggregationProperties": [
""
]
}
],
"window": {
"start": "",
"end": ""
}
}
}
CostMetric
parameterUsing the endpoint /model/cloudCost/top
will accept all parameters of model/cloudCost/view
except for MetricCost
.
CostMetric
values are based on and calculated following standard FinOps dimensions and metrics. The four available metrics supported by the Cloud Cost API are:
NetCost
Costs inclusive of discounts and credits. Will also include one-time and recurring charges.
AmortizedNetCost
NetCost
with removed cash upfront fees and amortized
ListCost
CSP pricing without any discounts
InvoicedCost
Pricing based on usage during billing period
Providing a value for CostMetric
is optional, but it will default to AmortizedNetCost
if not otherwise provided.
kubernetesPercent
Each CostMetric
also has a kubernetesPercent
value. Unaggregated, this value will be 0 or 1. When you aggregate, kubernetesPercent
is determined by multiplying the costMetric
cost by its kubernetesPercent
and aggregating that value as kubernetesCost
for that costMetric
. That kubernetesCost
is then divided by the aggregated total costs to determine the new kubernetesPercent
. Since this process results in unique values for each costMetric
, this value is included as part of the cost metric.
http://<your-kubecost-address>/model/cloudCost/aggregate?window=3d&aggregate=service&filterProviders=AWS
```json
{
"code": 200,
"data": {
"sets": [
{
"cloudCosts": {
"5hnnev4d0v7mapf09j0v8of0o2": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "5hnnev4d0v7mapf09j0v8of0o2"
},
"window": {
"start": "2023-04-30T00:00:00Z",
"end": "2023-05-01T00:00:00Z"
},
"listCost": {
"cost": 8.207999999999997,
"kubernetesPercent": 0
},
"netCost": {
"cost": 8.207999999999997,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 8.207999999999997,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 8.207999999999997,
"kubernetesPercent": 0
}
},
"AWSBackup": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "AWSBackup",
"labels": {
"name": "khand-dev"
}
},
"window": {
"start": "2023-04-30T00:00:00Z",
"end": "2023-05-01T00:00:00Z"
},
"listCost": {
"cost": 4e-10,
"kubernetesPercent": 0
},
"netCost": {
"cost": 4e-10,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 4e-10,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 4e-10,
"kubernetesPercent": 0
}
},
"AWSCloudTrail": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "AWSCloudTrail"
},
"window": {
"start": "2023-04-30T00:00:00Z",
"end": "2023-05-01T00:00:00Z"
},
"listCost": {
"cost": 4.9206699999999985,
"kubernetesPercent": 0
},
"netCost": {
"cost": 4.9206699999999985,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 4.9206699999999985,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 4.9206699999999985,
"kubernetesPercent": 0
}
},
"AWSCostExplorer": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "AWSCostExplorer"
},
"window": {
"start": "2023-04-30T00:00:00Z",
"end": "2023-05-01T00:00:00Z"
},
"listCost": {
"cost": 0.26426064520000003,
"kubernetesPercent": 0
},
"netCost": {
"cost": 0.26426064520000003,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 0.26426064520000003,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 0.26426064520000003,
"kubernetesPercent": 0
}
},
"AWSELB": {
"properties": {
"provider": "AWS",
"invoiceEntityID": "297945954695",
"service": "AWSELB"
},
"window": {
"start": "2023-04-30T00:00:00Z",
"end": "2023-05-01T00:00:00Z"
},
"listCost": {
"cost": 43.00682560389998,
"kubernetesPercent": 0.8073338296107909
},
"netCost": {
"cost": 43.00682560389998,
"kubernetesPercent": 0.8073338296107909
},
"amortizedNetCost": {
"cost": 43.00682560389998,
"kubernetesPercent": 0.8073338296107909
},
"invoicedCost": {
"cost": 43.00682560389998,
"kubernetesPercent": 0.8073338296107909
}
},
"AWSGlue": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "AWSGlue"
},
"window": {
"start": "2023-04-30T00:00:00Z",
"end": "2023-05-01T00:00:00Z"
},
"listCost": {
"cost": 0.43269115999999996,
"kubernetesPercent": 0
},
"netCost": {
"cost": 0.43269115999999996,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 0.43269115999999996,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 0.43269115999999996,
"kubernetesPercent": 0
}
},
"AWSLambda": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "AWSLambda"
},
"window": {
"start": "2023-04-30T00:00:00Z",
"end": "2023-05-01T00:00:00Z"
},
"listCost": {
"cost": 0,
"kubernetesPercent": 0
},
"netCost": {
"cost": 0,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 0,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 0,
"kubernetesPercent": 0
}
},
"AWSQueueService": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "AWSQueueService"
},
"window": {
"start": "2023-04-30T00:00:00Z",
"end": "2023-05-01T00:00:00Z"
},
"listCost": {
"cost": 0,
"kubernetesPercent": 0
},
"netCost": {
"cost": 0,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 0,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 0,
"kubernetesPercent": 0
}
},
"AmazonAthena": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "AmazonAthena"
},
"window": {
"start": "2023-04-30T00:00:00Z",
"end": "2023-05-01T00:00:00Z"
},
"listCost": {
"cost": 0.10061275,
"kubernetesPercent": 0
},
"netCost": {
"cost": 0.10061275,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 0.10061275,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 0.10061275,
"kubernetesPercent": 0
}
},
"AmazonCloudWatch": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "AmazonCloudWatch"
},
"window": {
"start": "2023-04-30T00:00:00Z",
"end": "2023-05-01T00:00:00Z"
},
"listCost": {
"cost": 0.21150513669999998,
"kubernetesPercent": 0
},
"netCost": {
"cost": 0.21150513669999998,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 0.21150513669999998,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 0.21150513669999998,
"kubernetesPercent": 0
}
},
"AmazonEC2": {
"properties": {
"provider": "AWS",
"invoiceEntityID": "297945954695",
"service": "AmazonEC2"
},
"window": {
"start": "2023-04-30T00:00:00Z",
"end": "2023-05-01T00:00:00Z"
},
"listCost": {
"cost": 337.4926118030998,
"kubernetesPercent": 0.6543833295809984
},
"netCost": {
"cost": 337.4926118030998,
"kubernetesPercent": 0.6543833295809984
},
"amortizedNetCost": {
"cost": 337.4926118030998,
"kubernetesPercent": 0.6543833295809984
},
"invoicedCost": {
"cost": 337.4926118030998,
"kubernetesPercent": 0.6543833295809984
}
},
"AmazonECR": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "AmazonECR"
},
"window": {
"start": "2023-04-30T00:00:00Z",
"end": "2023-05-01T00:00:00Z"
},
"listCost": {
"cost": 0.00018308879999999998,
"kubernetesPercent": 0
},
"netCost": {
"cost": 0.00018308879999999998,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 0.00018308879999999998,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 0.00018308879999999998,
"kubernetesPercent": 0
}
},
"AmazonECRPublic": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "AmazonECRPublic"
},
"window": {
"start": "2023-04-30T00:00:00Z",
"end": "2023-05-01T00:00:00Z"
},
"listCost": {
"cost": 0,
"kubernetesPercent": 0
},
"netCost": {
"cost": 0,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 0,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 0,
"kubernetesPercent": 0
}
},
"AmazonEFS": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "AmazonEFS"
},
"window": {
"start": "2023-04-30T00:00:00Z",
"end": "2023-05-01T00:00:00Z"
},
"listCost": {
"cost": 6.123e-07,
"kubernetesPercent": 0
},
"netCost": {
"cost": 6.123e-07,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 6.123e-07,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 6.123e-07,
"kubernetesPercent": 0
}
},
"AmazonEKS": {
"properties": {
"provider": "AWS",
"invoiceEntityID": "297945954695",
"service": "AmazonEKS"
},
"window": {
"start": "2023-04-30T00:00:00Z",
"end": "2023-05-01T00:00:00Z"
},
"listCost": {
"cost": 43.19999999999999,
"kubernetesPercent": 1
},
"netCost": {
"cost": 43.19999999999999,
"kubernetesPercent": 1
},
"amortizedNetCost": {
"cost": 43.19999999999999,
"kubernetesPercent": 1
},
"invoicedCost": {
"cost": 43.19999999999999,
"kubernetesPercent": 1
}
},
"AmazonFSx": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "AmazonFSx"
},
"window": {
"start": "2023-04-30T00:00:00Z",
"end": "2023-05-01T00:00:00Z"
},
"listCost": {
"cost": 5.6010275086000005,
"kubernetesPercent": 0
},
"netCost": {
"cost": 5.6010275086000005,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 5.6010275086000005,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 5.6010275086000005,
"kubernetesPercent": 0
}
},
"AmazonPrometheus": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "AmazonPrometheus"
},
"window": {
"start": "2023-04-30T00:00:00Z",
"end": "2023-05-01T00:00:00Z"
},
"listCost": {
"cost": 5.03357787,
"kubernetesPercent": 0
},
"netCost": {
"cost": 5.03357787,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 5.03357787,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 5.03357787,
"kubernetesPercent": 0
}
},
"AmazonQuickSight": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "AmazonQuickSight"
},
"window": {
"start": "2023-04-30T00:00:00Z",
"end": "2023-05-01T00:00:00Z"
},
"listCost": {
"cost": 0.8000000064000001,
"kubernetesPercent": 0
},
"netCost": {
"cost": 0.8000000064000001,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 0.8000000064000001,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 0.8000000064000001,
"kubernetesPercent": 0
}
},
"AmazonRoute53": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "AmazonRoute53"
},
"window": {
"start": "2023-04-30T00:00:00Z",
"end": "2023-05-01T00:00:00Z"
},
"listCost": {
"cost": 0.0005856,
"kubernetesPercent": 0
},
"netCost": {
"cost": 0.0005856,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 0.0005856,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 0.0005856,
"kubernetesPercent": 0
}
},
"AmazonS3": {
"properties": {
"provider": "AWS",
"invoiceEntityID": "297945954695",
"service": "AmazonS3"
},
"window": {
"start": "2023-04-30T00:00:00Z",
"end": "2023-05-01T00:00:00Z"
},
"listCost": {
"cost": 45.7935617916,
"kubernetesPercent": 0
},
"netCost": {
"cost": 45.7935617916,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 45.7935617916,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 45.7935617916,
"kubernetesPercent": 0
}
},
"AmazonSNS": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "AmazonSNS"
},
"window": {
"start": "2023-04-30T00:00:00Z",
"end": "2023-05-01T00:00:00Z"
},
"listCost": {
"cost": 0,
"kubernetesPercent": 0
},
"netCost": {
"cost": 0,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 0,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 0,
"kubernetesPercent": 0
}
},
"AmazonVPC": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "AmazonVPC"
},
"window": {
"start": "2023-04-30T00:00:00Z",
"end": "2023-05-01T00:00:00Z"
},
"listCost": {
"cost": 2.8800000000000017,
"kubernetesPercent": 0
},
"netCost": {
"cost": 2.8800000000000017,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 2.8800000000000017,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 2.8800000000000017,
"kubernetesPercent": 0
}
},
"awskms": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "awskms"
},
"window": {
"start": "2023-04-30T00:00:00Z",
"end": "2023-05-01T00:00:00Z"
},
"listCost": {
"cost": 0.23333333520000016,
"kubernetesPercent": 0
},
"netCost": {
"cost": 0.23333333520000016,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 0.23333333520000016,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 0.23333333520000016,
"kubernetesPercent": 0
}
}
},
"window": {
"start": "2023-04-30T00:00:00Z",
"end": "2023-05-01T00:00:00Z"
},
"aggregationProperties": [
"service"
]
},
{
"cloudCosts": {
"5hnnev4d0v7mapf09j0v8of0o2": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "5hnnev4d0v7mapf09j0v8of0o2"
},
"window": {
"start": "2023-05-01T00:00:00Z",
"end": "2023-05-02T00:00:00Z"
},
"listCost": {
"cost": 7.865999999999996,
"kubernetesPercent": 0
},
"netCost": {
"cost": 7.865999999999996,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 7.865999999999996,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 7.865999999999996,
"kubernetesPercent": 0
}
},
"AWSCloudTrail": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "AWSCloudTrail"
},
"window": {
"start": "2023-05-01T00:00:00Z",
"end": "2023-05-02T00:00:00Z"
},
"listCost": {
"cost": 6.373088000000007,
"kubernetesPercent": 0
},
"netCost": {
"cost": 6.373088000000007,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 6.373088000000007,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 6.373088000000007,
"kubernetesPercent": 0
}
},
"AWSCostExplorer": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "AWSCostExplorer"
},
"window": {
"start": "2023-05-01T00:00:00Z",
"end": "2023-05-02T00:00:00Z"
},
"listCost": {
"cost": 0.24415709680000003,
"kubernetesPercent": 0
},
"netCost": {
"cost": 0.24415709680000003,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 0.24415709680000003,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 0.24415709680000003,
"kubernetesPercent": 0
}
},
"AWSELB": {
"properties": {
"provider": "AWS",
"invoiceEntityID": "297945954695",
"service": "AWSELB"
},
"window": {
"start": "2023-05-01T00:00:00Z",
"end": "2023-05-02T00:00:00Z"
},
"listCost": {
"cost": 41.16003439479998,
"kubernetesPercent": 0.8082905243733983
},
"netCost": {
"cost": 41.16003439479998,
"kubernetesPercent": 0.8082905243733983
},
"amortizedNetCost": {
"cost": 41.16003439479998,
"kubernetesPercent": 0.8082905243733983
},
"invoicedCost": {
"cost": 41.16003439479998,
"kubernetesPercent": 0.8082905243733983
}
},
"AWSGlue": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "AWSGlue"
},
"window": {
"start": "2023-05-01T00:00:00Z",
"end": "2023-05-02T00:00:00Z"
},
"listCost": {
"cost": 0.5083949200000001,
"kubernetesPercent": 0
},
"netCost": {
"cost": 0.5083949200000001,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 0.5083949200000001,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 0.5083949200000001,
"kubernetesPercent": 0
}
},
"AWSLambda": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "AWSLambda"
},
"window": {
"start": "2023-05-01T00:00:00Z",
"end": "2023-05-02T00:00:00Z"
},
"listCost": {
"cost": 0,
"kubernetesPercent": 0
},
"netCost": {
"cost": 0,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 0,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 0,
"kubernetesPercent": 0
}
},
"AWSQueueService": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "AWSQueueService"
},
"window": {
"start": "2023-05-01T00:00:00Z",
"end": "2023-05-02T00:00:00Z"
},
"listCost": {
"cost": 0,
"kubernetesPercent": 0
},
"netCost": {
"cost": 0,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 0,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 0,
"kubernetesPercent": 0
}
},
"AmazonAthena": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "AmazonAthena"
},
"window": {
"start": "2023-05-01T00:00:00Z",
"end": "2023-05-02T00:00:00Z"
},
"listCost": {
"cost": 10.695624500000003,
"kubernetesPercent": 0
},
"netCost": {
"cost": 10.695624500000003,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 10.695624500000003,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 10.695624500000003,
"kubernetesPercent": 0
}
},
"AmazonCloudWatch": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "AmazonCloudWatch"
},
"window": {
"start": "2023-05-01T00:00:00Z",
"end": "2023-05-02T00:00:00Z"
},
"listCost": {
"cost": 0.0148635813,
"kubernetesPercent": 0
},
"netCost": {
"cost": 0.0148635813,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 0.0148635813,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 0.0148635813,
"kubernetesPercent": 0
}
},
"AmazonEC2": {
"properties": {
"provider": "AWS",
"invoiceEntityID": "297945954695",
"service": "AmazonEC2"
},
"window": {
"start": "2023-05-01T00:00:00Z",
"end": "2023-05-02T00:00:00Z"
},
"listCost": {
"cost": 309.4241635897003,
"kubernetesPercent": 0.6593596481215193
},
"netCost": {
"cost": 309.4241635897003,
"kubernetesPercent": 0.6593596481215193
},
"amortizedNetCost": {
"cost": 309.4241635897003,
"kubernetesPercent": 0.6593596481215193
},
"invoicedCost": {
"cost": 309.4241635897003,
"kubernetesPercent": 0.6593596481215193
}
},
"AmazonECR": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "AmazonECR"
},
"window": {
"start": "2023-05-01T00:00:00Z",
"end": "2023-05-02T00:00:00Z"
},
"listCost": {
"cost": 0.00014835589999999998,
"kubernetesPercent": 0
},
"netCost": {
"cost": 0.00014835589999999998,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 0.00014835589999999998,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 0.00014835589999999998,
"kubernetesPercent": 0
}
},
"AmazonECRPublic": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "AmazonECRPublic"
},
"window": {
"start": "2023-05-01T00:00:00Z",
"end": "2023-05-02T00:00:00Z"
},
"listCost": {
"cost": 0,
"kubernetesPercent": 0
},
"netCost": {
"cost": 0,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 0,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 0,
"kubernetesPercent": 0
}
},
"AmazonEFS": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "AmazonEFS"
},
"window": {
"start": "2023-05-01T00:00:00Z",
"end": "2023-05-02T00:00:00Z"
},
"listCost": {
"cost": 5.681000000000001e-07,
"kubernetesPercent": 0
},
"netCost": {
"cost": 5.681000000000001e-07,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 5.681000000000001e-07,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 5.681000000000001e-07,
"kubernetesPercent": 0
}
},
"AmazonEKS": {
"properties": {
"provider": "AWS",
"invoiceEntityID": "297945954695",
"service": "AmazonEKS"
},
"window": {
"start": "2023-05-01T00:00:00Z",
"end": "2023-05-02T00:00:00Z"
},
"listCost": {
"cost": 39.6,
"kubernetesPercent": 1
},
"netCost": {
"cost": 39.6,
"kubernetesPercent": 1
},
"amortizedNetCost": {
"cost": 39.6,
"kubernetesPercent": 1
},
"invoicedCost": {
"cost": 39.6,
"kubernetesPercent": 1
}
},
"AmazonFSx": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "AmazonFSx"
},
"window": {
"start": "2023-05-01T00:00:00Z",
"end": "2023-05-02T00:00:00Z"
},
"listCost": {
"cost": 4.968756381500007,
"kubernetesPercent": 0
},
"netCost": {
"cost": 4.968756381500007,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 4.968756381500007,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 4.968756381500007,
"kubernetesPercent": 0
}
},
"AmazonPrometheus": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "AmazonPrometheus"
},
"window": {
"start": "2023-05-01T00:00:00Z",
"end": "2023-05-02T00:00:00Z"
},
"listCost": {
"cost": 1.04940423,
"kubernetesPercent": 0
},
"netCost": {
"cost": 1.04940423,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 1.04940423,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 1.04940423,
"kubernetesPercent": 0
}
},
"AmazonQuickSight": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "AmazonQuickSight"
},
"window": {
"start": "2023-05-01T00:00:00Z",
"end": "2023-05-02T00:00:00Z"
},
"listCost": {
"cost": 0.7419354719999997,
"kubernetesPercent": 0
},
"netCost": {
"cost": 0.7419354719999997,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 0.7419354719999997,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 0.7419354719999997,
"kubernetesPercent": 0
}
},
"AmazonRoute53": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "AmazonRoute53"
},
"window": {
"start": "2023-05-01T00:00:00Z",
"end": "2023-05-02T00:00:00Z"
},
"listCost": {
"cost": 1.5010184,
"kubernetesPercent": 0
},
"netCost": {
"cost": 1.5010184,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 1.5010184,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 1.5010184,
"kubernetesPercent": 0
}
},
"AmazonS3": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "AmazonS3"
},
"window": {
"start": "2023-05-01T00:00:00Z",
"end": "2023-05-02T00:00:00Z"
},
"listCost": {
"cost": 35.486366779799866,
"kubernetesPercent": 0
},
"netCost": {
"cost": 35.486366779799866,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 35.486366779799866,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 35.486366779799866,
"kubernetesPercent": 0
}
},
"AmazonSNS": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "AmazonSNS"
},
"window": {
"start": "2023-05-01T00:00:00Z",
"end": "2023-05-02T00:00:00Z"
},
"listCost": {
"cost": 0,
"kubernetesPercent": 0
},
"netCost": {
"cost": 0,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 0,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 0,
"kubernetesPercent": 0
}
},
"AmazonVPC": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "AmazonVPC"
},
"window": {
"start": "2023-05-01T00:00:00Z",
"end": "2023-05-02T00:00:00Z"
},
"listCost": {
"cost": 2.849999999999996,
"kubernetesPercent": 0
},
"netCost": {
"cost": 2.849999999999996,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 2.849999999999996,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 2.849999999999996,
"kubernetesPercent": 0
}
},
"AmazonWorkSpaces": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "AmazonWorkSpaces"
},
"window": {
"start": "2023-05-01T00:00:00Z",
"end": "2023-05-02T00:00:00Z"
},
"listCost": {
"cost": 38,
"kubernetesPercent": 0
},
"netCost": {
"cost": 38,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 38,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 38,
"kubernetesPercent": 0
}
},
"awskms": {
"properties": {
"provider": "AWS",
"accountID": "297945954695",
"invoiceEntityID": "297945954695",
"service": "awskms"
},
"window": {
"start": "2023-05-01T00:00:00Z",
"end": "2023-05-02T00:00:00Z"
},
"listCost": {
"cost": 0.2163978459999994,
"kubernetesPercent": 0
},
"netCost": {
"cost": 0.2163978459999994,
"kubernetesPercent": 0
},
"amortizedNetCost": {
"cost": 0.2163978459999994,
"kubernetesPercent": 0
},
"invoicedCost": {
"cost": 0.2163978459999994,
"kubernetesPercent": 0
}
}
},
"window": {
"start": "2023-05-01T00:00:00Z",
"end": "2023-05-02T00:00:00Z"
},
"aggregationProperties": [
"service"
]
},
{
"cloudCosts": {},
"window": {
"start": "2023-05-02T00:00:00Z",
"end": "2023-05-03T00:00:00Z"
},
"aggregationProperties": [
"service"
]
}
],
"window": {
"start": "2023-04-30T00:00:00Z",
"end": "2023-05-03T00:00:00Z"
}
}
}
```
http:/<your-kubecost-address>/model/cloudCost/view?window=2d&filterServices=AmazonEC2&aggregate=invoiceEntityID
```json
{
"code": 200,
"data": {
"graphData": [
{
"start": "2023-05-01T00:00:00Z",
"end": "2023-05-02T00:00:00Z",
"items": [
{
"name": "297945954695",
"value": 309.4241635897003
}
]
},
{
"start": "2023-05-02T00:00:00Z",
"end": "2023-05-03T00:00:00Z",
"items": []
}
],
"tableTotal": {
"name": "Totals",
"kubernetesPercent": 0.6593596481215193,
"cost": 309.4241635897003
},
"tableRows": [
{
"name": "297945954695",
"kubernetesPercent": 0.6593596481215193,
"cost": 309.4241635897003
}
]
}
```
This feature is only available in .
GET
http://<your-kubecost-address>/model/cloudCost/view/trends
Analyzes change in cloud costs relative to a previous window of the same size
The Trends API determines changes in resource cost usage over time based on the interval set window
parameter and provides that information via the schema field value
. Cost usage for the current window
sampled will be compared with comparisonWindow
, the window directly before the current window of the same size interval. For example, for window=3d
, Kubecost will output cost usage for the past three days compared to cost usage of the three days before the start of the window. This means a total of six days of cloud cost data are sampled in order to provide an accurate value.
The equation for calculating value
is: value=window/comparisonWindow - 1
Receiving a positive value
means spending has increased in the current window
when compared to comparisonWindow
. A negative value
means spending has decreased.
It's important to recognize when a resource is not detected to exist in the previous window. This is designated by the field IsInfinite=true
, which means the allocation could not be determined to exist. Otherwise, the cause of an unexpected or major trend change could be misattributed. The field isNaN
, meaning not a number, refers to if the value
is unreal. If so, isNan
should return true
, which means there was an error during calculation. Both fields should return false
during a successful query.
In the example output below, value
is expressed as -0.147
, meaning spending has decreased for project-123
by roughly 14.7%.
Trend values are converted into percentages in the Kubecost Cloud Costs Explorer page, calculated based on your current query. Trends will be presented in the rightmost column, next to your Total cost. The window
parameter is determined by your selected date range in the top right of the page. The default is Last 7 days (window=7d
). The equation value*100
is used to provide percentages.
names
parameternames
is a mandatory parameter which determines the sequence of items returned, based on whatever the query is aggregating by. For example, when using aggregate=provider
, the user should provide a comma-separated list of all providers they wish to see trend values for in this category. In this case, they should provide names=AWS,GCP,Azure
to receive a list of trend values for all three providers. If the user does not provide a value for aggregate
, they must still use the names parameter to list all line items requested.
Window of the query. Accepts all standard Kubecost window formats (See our doc on using ).
window*
string
Duration of time over which to query. Compares cost usage of window to cost usage window of equal size directly preceding it. Accepts all standard Kubecost window formats (See our doc on using the window
parameter).
names*
string
Determines order sequence of queried items via comma-separated list. Dependent on the value of aggregate
to list items. See more below.
aggregate
string
Field by which to aggregate the results. Accepts: invoiceEntityID
, accountID
, provider
, service
, and label:<name>
. Supports multi-aggregation using comma-separated lists, such as aggregate=accountID,service
. When no value is provided, the query will aggregate by individual items.
accumulate
boolean
When set to false
, returns daily time series data vs. cumulative data. Default is true
.
CostMetricName
string
Determines which cloud cost metric type will be returned. Acceptable values are AmortizedNetCost
, InvoicedCost
, ListCost
, and NetCost
. Default is AmortizedNetCost
.
filter
string
Filter your results by a particular category or value. For example, when to only see trends in AWS spend, set this parameter to filter=provider:"AWS"
. Supports Filter Parameters (v2) language.
{
"code": 200,
"data": {
"trends": {
"": {
"isInfinite": false,
"isNaN": false,
"value": 0.000
}
},
"window": {
"start": "",
"end": ""
},
"comparisonWindow": {
"start": "",
"end": ""
}
}
}
"trends": {
"project-123": {
"isInfinite": false,
"isNaN": false,
"value": -0.1472170691451784
}
},
"window": {
"start": "2023-11-29T00:00:00Z",
"end": "2023-12-06T00:00:00Z"
},
"comparisonWindow": {
"start": "2023-11-22T00:00:00Z",
"end": "2023-11-29T00:00:00Z"
}