From e1360c0fbd77a1f38629a39d1488009548888eab Mon Sep 17 00:00:00 2001 From: badra001 Date: Fri, 22 Aug 2025 11:22:24 -0400 Subject: [PATCH] update billing --- inventory/get-billing.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/inventory/get-billing.sh b/inventory/get-billing.sh index ea7b42a..738bf4d 100755 --- a/inventory/get-billing.sh +++ b/inventory/get-billing.sh @@ -1,6 +1,6 @@ #!/bin/bash -VERSION="1.0.2" +VERSION="1.1.0" caller=$(tf-aws sts get-caller-identity --query 'Arn' 2> /dev/null) if [ $(echo $caller | grep -c aws-us-gov) != 0 ] @@ -32,4 +32,9 @@ tf-aws ce get-cost-and-usage \ grep ^BLEND setup/cost-usage.${lastmonth}_${nextmonth}.txt |\ awk '{t+=$2} END {print NR,t}' > setup/cost-usage.${lastmonth}_${nextmonth}.summary +jq -c '.ResultsByTime[] | .Groups[] | [.Keys[0],.Metrics.UnblendedCost.Amount,.Metrics.BlendedCost.Amount,.Metrics.UsageQuantity.Amount] | @csv' \ + setup/cost-usage.${lastmonth}_${nextmonth}.json |\ + sed -e 's/\\"//g' -e 's/"//g'|sort -t, -k 2 -nr \ + > setup/cost-usage.${lastmonth}_${nextmonth}.csv + exit 0