#! /bin/bash
echo "Collecting volume info"
aws ec2 describe-volumes --region us-east-1 --query 'Volumes[*].{Size:Size}' --output table | awk 'NR>5 {print $2}' > /tmp/ax
aws ec2 describe-volumes --region us-east-1 --query 'Volumes[*].{Size:Size,SnapshotId:SnapshotId}' --output table | grep snap | awk '{print $2}'> /tmp/ay
sumvol=0
sumsnap=0
#Volumes sum
for i in `cat /tmp/ax`
do
sumvol=`expr $sumvol + $i`
done
echo "Total Volumes Size :" $sumvol
#Snapshot sum
for j in `cat /tmp/ay`
do
sumsnap=`expr $sumsnap + $j`
done
echo "Total Snapshot Size :" $sumsnap
No comments:
Post a Comment