Last active
July 29, 2025 20:00
-
-
Save duboisf/5c7568bedfb478b5cb0c4f2205918a71 to your computer and use it in GitHub Desktop.
AWS EKS per deployment costs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Note: pods that aren't part of a deployment will be summed up together | |
-- I _think_ this gives total cost per pod......... | |
-- Ref: https://docs.aws.amazon.com/cur/latest/userguide/example-split-cost-allocation-data.html | |
SELECT | |
ELEMENT_AT(resource_tags, 'aws_eks_cluster_name') AS eks_cluster, | |
ELEMENT_AT(resource_tags, 'aws_eks_namespace') AS namespace, | |
ELEMENT_AT(resource_tags, 'aws_eks_deployment') AS deployment, | |
ROUND(SUM(split_line_item_split_cost), 2) AS split_cost, | |
ROUND(SUM(split_line_item_unused_cost), 2) AS split_unused_cost, | |
ROUND(SUM(split_line_item_split_cost) + SUM(split_line_item_unused_cost), 2) as total_cost | |
FROM cur.cur | |
WHERE billing_period = '2025-06' AND line_item_operation = 'EKSPod-EC2' | |
GROUP BY | |
ELEMENT_AT(resource_tags, 'aws_eks_cluster_name'), | |
ELEMENT_AT(resource_tags, 'aws_eks_namespace'), | |
ELEMENT_AT(resource_tags, 'aws_eks_deployment') | |
ORDER BY total_cost DESC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment