Skip to content

Instantly share code, notes, and snippets.

@enisozgen
Last active February 20, 2017 11:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enisozgen/204bf95270311699038c98e3fc51393c to your computer and use it in GitHub Desktop.
Save enisozgen/204bf95270311699038c98e3fc51393c to your computer and use it in GitHub Desktop.
Show all EBS volumes size by filtering any environment
# Shows all volumes of any environment
REGION='us-east-1'
VOLUMES=$(aws ec2 describe-instances --region=$REGION --query 'Reservations[*].Instances[*].BlockDeviceMappings[*].Ebs' --filter "Name=tag:Environment,Values=Uat" --output text | awk '{print($4)}')
echo "Your volumes $VOLUMES"
for VOLUME in $VOLUMES
do
aws ec2 describe-volumes --region $REGION --volume-ids $VOLUME --query 'Volumes[*].Size' --output text
done
@enisozgen
Copy link
Author

enisozgen commented Feb 20, 2017

First you have to write .boto your credentials

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment