Created
September 7, 2011 10:09
-
-
Save KentaroAOKI/1200207 to your computer and use it in GitHub Desktop.
A script to use https://gist.github.com/1200104 to query the All AWS usage reports programmatically.
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/sh | |
AWSUSAGE=aws_usage.py | |
TEMPFILE=/tmp/aws_all_prev_usage$$.xml | |
USERID=$1 | |
PASSWORD=$2 | |
if [ "" = "$USERID" ] | |
then | |
exit | |
fi | |
if [ "" = "$PASSWORD" ] | |
then | |
exit | |
fi | |
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > $TEMPFILE | |
echo "<ServiceUsage>" >> $TEMPFILE | |
for SERVICE in `$AWSUSAGE -l` | |
do | |
$AWSUSAGE -s $SERVICE -f xml -U "$USERID" -P "$PASSWORD" -t aws-portal-prev-bill-period | grep -v "^<" >> $TEMPFILE | |
done | |
echo "</ServiceUsage>" >> $TEMPFILE | |
cat $TEMPFILE | |
rm $TEMPFILE | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment