Created
March 1, 2019 15:15
-
-
Save efazati/b2232bcee05b07728fd4009ab55cbec2 to your computer and use it in GitHub Desktop.
clean unused volume from EBS
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
export AWS_PROFILE=xxxx; | |
aws ec2 describe-volumes --filters "Name=status,Values=available" --output json --profile $AWS_PROFILE| python -c "from __future__ import print_function; import json,sys;data=json.load(sys.stdin); [ print(v['VolumeId']) for v in data['Volumes']]" | xargs -n 1 -I % aws ec2 delete-volume --volume-id=% --profile $AWS_PROFILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment