Cost monitoring - Amazon EKS
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Cost monitoring

Amazon EKS supports Kubecost, which you can use to monitor your costs broken down by Kubernetes resources including pods, nodes, namespaces, and labels. As a Kubernetes platform administrator and finance leader, you can use Kubecost to visualize a breakdown of Amazon EKS charges, allocate costs, and charge back organizational units such as application teams. You can provide your internal teams and business units with transparent and accurate cost data based on their actual Amazon bill. Moreover, you can also get customized recommendations for cost optimization based on their infrastructure environment and usage patterns within their clusters. For more information about Kubecost, see the Kubecost documentation.

Amazon EKS provides an Amazon optimized bundle of Kubecost for cluster cost visibility. You can use your existing Amazon support agreements to obtain support.

  • An existing Amazon EKS cluster. To deploy one, see Getting started with Amazon EKS. The cluster must have Amazon EC2 nodes because you can't run Kubecost on Fargate nodes.

  • The kubectl command line tool is installed on your device or Amazon CloudShell. The version can be the same as or up to one minor version earlier or later than the Kubernetes version of your cluster. For example, if your cluster version is 1.24, you can use kubectl version 1.23, 1.24, or 1.25 with it. To install or upgrade kubectl, see Installing or updating kubectl.

  • Helm version 3.9.0 or later configured on your device or Amazon CloudShell. To install or update Helm, see Using Helm with Amazon EKS.

  • If your cluster is version 1.23 or later, you must have the Amazon EBS CSI driver installed on your cluster.

To install Kubecost
  1. Install Kubecost with the following command. You can replace 1.96.0 with a later version. You can see the available versions at kubecost/cost-analyzer in the Amazon ECR Public Gallery.

    helm upgrade -i kubecost oci:// --version 1.96.0 \ --namespace kubecost --create-namespace \ -f

    Kubecost releases new versions regularly. You can update your version using helm upgrade. By default, the installation includes a local Prometheus server and kube-state-metrics. You can customize your deployment to use Amazon Managed Service for Prometheus by following the documentation in Integrating with Amazon EKS cost monitoring. For a list of all other settings that you can configure, see the sample configuration file on GitHub.

  2. Make sure the required pods are running.

    kubectl get pods -n kubecost

    The example output is as follows.

    NAME READY STATUS RESTARTS AGE kubecost-cost-analyzer-b9788c99f-5vj5b 2/2 Running 0 3h27m kubecost-kube-state-metrics-99bb8c55b-bn2br 1/1 Running 0 3h27m kubecost-prometheus-server-7d9967bfc8-9c8p7 2/2 Running 0 3h27m
  3. On your device, enable port-forwarding to expose the Kubecost dashboard.

    kubectl port-forward --namespace kubecost deployment/kubecost-cost-analyzer 9090

    Alternatively, you can use the Amazon Load Balancer Controller to expose Kubecost and use Amazon Cognito for authentication, authorization, and user management. For more information, see How to use Application Load Balancer and Amazon Cognito to authenticate users for your Kubernetes web apps.

  4. On the same device that you completed the previous step on, open a web browser and enter the following address.


    You see the Kubecost Overview page in your browser. It might take 5–10 minutes for Kubecost to gather metrics. You can see your Amazon EKS spend, including cumulative cluster costs, associated Kubernetes asset costs, and monthly aggregated spend.

                    Kubecost dashboard
  5. To track costs at a cluster level, tag your Amazon EKS resources for billing. For more information, see Tagging your resources for billing.

You can also view the following information by selecting it in the left pane of the dashboard:
  • Cost allocation – View monthly Amazon EKS costs and cumulative costs for each of your namespaces and other dimensions over the past seven days. This is helpful for understanding which parts of your application are contributing to Amazon EKS spend.

  • Assets – View the costs of the Amazon infrastructure assets that are associated with your Amazon EKS resources.

Additional features
  • Export cost metrics – Amazon EKS optimized cost monitoring is deployed with Kubecost and Prometheus, which is an open-source monitoring system and time series database. Kubecost reads metric from Prometheus and then performs cost allocation calculations and writes the metrics back to Prometheus. The Kubecost front-end reads metrics from Prometheus and shows them on the Kubecost user interface. The architecture is illustrated in the following diagram.

                    Kubecost architecture

    With Prometheus pre-installed, you can write queries to ingest Kubecost data into your current business intelligence system for further analysis. You can also use it as a data source for your current Grafana dashboard to display Amazon EKS cluster costs that your internal teams are familiar with. To learn more about how to write Prometheus queries, see the Prometheus Configuration readme file on GitHub or use the example Grafana JSON models in the Kubecost Github repository as references.

  • Amazon Cost and Usage Report integration – To perform cost allocation calculations for your Amazon EKS cluster, Kubecost retrieves the public pricing information of Amazon Web Services and Amazon resources from the Amazon Price List API. You can also integrate Kubecost with Amazon Cost and Usage Report to enhance the accuracy of the pricing information specific to your Amazon Web Services account. This information includes enterprise discount programs, reserved instance usage, savings plans, and spot usage. To learn more about how the Amazon Cost and Usage Report integration works, see Amazon Cloud Integration in the Kubecost documentation.

Remove Kubecost

You can remove Kubecost from your cluster with the following commands.

helm uninstall kubecost --namespace kubecost kubectl delete ns kubecost

Frequently asked questions

See the following common questions and answers about using Kubecost with Amazon EKS.

Amazon and Kubecost collaborated to offer a customized version of Kubecost. This version includes a subset of commercial features at no additional charge. In the customized Kubecost version, customers get all open source features of Kubecost, cost allocation features, integration with Amazon Cost and Usage Report (CUR) for accurate cost visibility, cost efficiency measurements, 15-days of metrics processing, authentication for the Kubecost endpoint- using Amazon Cognito, and enterprise support. The customized Kubecost version does not include multi-cloud support, optimization insights, alerts and governance, unlimited metrics processsing, single sign on (SSO) and role based access control (RBAC) with SAML 2.0, and unnamed and future enterprise features of Kubecost.

No. You can use this version of Kubecost at no additional charge. If you want additional Kubecost capabilities that aren't included in this bundle, you can buy an enterprise license of Kubecost through the Amazon Web Services Marketplace, or from Kubecost directly.

Yes. You can open a support case with the Amazon Support team at Contact Amazon.


Yes. You can configure Kubecost to ingest data from Amazon Cost and Usage Report to get accurate cost visibility, including discounts, Spot pricing, reserved instance pricing, and others. For more information, see Amazon Cloud Integration in the Kubecost documentation.

No. This version is only compatible with Amazon EKS clusters.

Kubecost provides best effort to show cluster cost visibility for Amazon EKS on Fargate, but with lower accuracy than with Amazon EKS on Amazon EC2. This is primarily due to the difference in how you're billed for your usage. With Amazon EKS on Fargate, you're billed for consumed resources. With Amazon EKS on Amazon EC2 nodes, you're billed for provisioned resources. Kubecost calculates the cost of an Amazon EC2 node based on the node specification, which includes CPU, RAM, and ephemeral storage. With Fargate, costs are calculated based on the requested resources for the Fargate pods.

You can upgrade your Kubecost version using standard Helm upgrade procedures. The latest versions are in the Amazon ECR Public Gallery.

Yes. Kubectl-cost is an open source tool by Kubecost (Apache 2.0 License) that provides CLI access to Kubernetes cost allocation metrics. To install kubectl-cost, see Installation on GitHub.

Kubecost provides a web dashboard that you can access through kubectl port forwarding, an ingress, or a load balancer. You can also use the Amazon Load Balancer Controller to expose Kubecost and use Amazon Cognito for authentication, authorization, and user management. For more information, see How to use Application Load Balancer and Amazon Cognito to authenticate users for your Kubernetes web apps on the Amazon blog.