Skip to content

Instantly share code, notes, and snippets.

@arubis
Created December 21, 2019 01:49
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 arubis/e0195c1ec33b4ea9219bbe1121882d9c to your computer and use it in GitHub Desktop.
Save arubis/e0195c1ec33b4ea9219bbe1121882d9c to your computer and use it in GitHub Desktop.
for vol_id in $(aws ec2 describe-volumes --filters="Name=status,Values=['available']" | jq '.Volumes[12].VolumeId' | sed 's/\"//g');
do aws ec2 create-snapshot --volume-id ${vol_id}
# do aws ec2 create-snapshot --volume-id ${vol_id} --tag-specifications="[{\"ResourceType\":\"snapshot\",\"Tags\":$(aws ec2 describe-volumes --volume-ids ${vol_id} | jq '.Volumes[].Tags' -c)}]"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment