fbpx
GEThttps://api.spotinst.io/mcs/kubernetes/cluster/{clusterIdentifier}/costs?fromDate={timeDate}&toDate={timeDate}&aggregationPeriod=daily&accountId={ACCOUNT_ID}

Describes Kubernetes cluster costs in a time range based on resource allocation.

The response will provide the costs distribution per cluster, namespace, and deployment.

For each entity response will contain breakdown to compute and EBS costs as well.

URL Parameters

Parameter Type Description
toDate * String

data values following either a date format (yyyy-mm-dd ; 2016-11-20) or Unix Timestamp (1494751821472)

fromDate * String

data values following either a date format (yyyy-mm-dd ; 2016-11-20) or Unix Timestamp (1494751821472)

aggregationPeriod String

Possible values: "daily", null. For daily value response contains aggregated data by day. If null - response returns sum of costs per period

ACCOUNT_ID String

Your Spotinst accountId associated with your token

Example: act-123abc
Request

Headers
{
    "Content-Type": "application/json",
    "Authorization": "Bearer ${token}"
}
Response - 200

Headers
{
    "Content-Type": "application/json"
}
Body
Copied!
Downloaded!
{
  "totalCost": 26.053198,
  "totalComputeCost": 22.017641,
  "totalEbsCost": 4.035556,
  "namespaces": [
    {
      "namespace": "kube-system",
      "cost": 5.048279,
      "computeCost": 1.012723,
      "ebsCost": 4.035556,
      "deployments": [
        {
          "name": "coredns",
          "namespace": "kube-system",
          "cost": 0.12225669,
          "computeCost": 0.12225669,
          "ebsCost": 0
        },
        {
          "name": "jenkins",
          "namespace": "kube-system",
          "cost": 0.08517743,
          "computeCost": 0.049621873,
          "ebsCost": 0.035555556
        }
      ],
      "statefulSets": [],
      "daemonSets": [],
      "jobs": [],
      "standAlonePodsCost": {
        "name": "standAlone",
        "namespace": "kube-system",
        "cost": 0.33340228,
        "computeCost": 0,
        "ebsCost": 0.33340228
      }
    }
  ],
  "deployments": [
    {
      "name": "standAlone",
      "namespace": "kube-system",
      "cost": 0.33340228,
      "computeCost": 0,
      "ebsCost": 0.33340228
    },
    {
      "name": "coredns",
      "namespace": "kube-system",
      "cost": 0.12225669,
      "computeCost": 0.12225669,
      "ebsCost": 0
    },
    {
      "name": "jenkins",
      "namespace": "kube-system",
      "cost": 0.08517743,
      "computeCost": 0.049621873,
      "ebsCost": 0.035555556
    }
  ],
  "headroomCost": 2.228458,
  "idleCost": 14.825266
}