Created
December 11, 2019 15:33
-
-
Save mrchristine/8568304a8b6a2db9e1ce57df7902dfbf to your computer and use it in GitHub Desktop.
Calculate S3 costs for Storage
This file contains 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
#!/bin/bash | |
# get the last date in the file | |
last_date=`cat $@ | awk -F',' '{print $5}' | awk '{print $1}' | grep -v "Start" | sort | uniq | tail -n1` | |
# pass in the report.csv and calculate total storage costs for StandardStorage tier | |
cat "$@" | grep $last_date | awk -F, '{printf "%.2f GB %s %s \n", $7/(1024**3 )/24, $4, $2}' | grep "StandardStorage" | uniq | sort -n | |
echo "Processed for $last_date" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment