Last active
May 3, 2016 23:17
-
-
Save epardee/ecedeec30dd2bc42b1420b551b29e9f3 to your computer and use it in GitHub Desktop.
Determine when EBS Snapshot completes
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
volumeid="vol-changeme" ; profile="changeme" ; description="New snap" ; nameofsnap="Changeme" ; snapid=$(aws ec2 create-snapshot --volume-id $volumeid --description "$description" --profile $profile | awk -F"\"SnapshotId\"\: \"" '{print $2}' | awk -F"\"" '{print $1}'); while [ $(aws ec2 describe-snapshots --snapshot-ids $snapid --profile $profile | grep Progress | awk '{print $2}' | awk -F"\"" '{print $2}' | awk -F"%" '{print $1}') -ne 100 ] ; do : ; done ; aws ec2 create-tags --resources $snapid --tags Key=Completed,Value="`date`" Key=Name,Value="$nameofsnap" --profile $profile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ironically aws ec2 describe-snapshots doesn't match Progress indicated in the AWS Console synchronously...