Advertisements
Skip to content

Get Volume ID of a Volume, if it exists

volume_name="Name of your volume"
volume_id=`aws ec2 describe-volumes --filters Name=tag-key,Values=diskuse,Name=tag-value,Values=${volume_name}  |jq -r --arg zone "$zone" '[.Volumes[] | select( (.State=="available") and (.AvailabilityZone==$zone))][0] | .VolumeId'`

 

Advertisements

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: