Skip to content

Instantly share code, notes, and snippets.

@epardee
Last active May 3, 2016 23:17
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 epardee/ecedeec30dd2bc42b1420b551b29e9f3 to your computer and use it in GitHub Desktop.
Save epardee/ecedeec30dd2bc42b1420b551b29e9f3 to your computer and use it in GitHub Desktop.
Determine when EBS Snapshot completes
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
@epardee
Copy link
Author

epardee commented May 3, 2016

Ironically aws ec2 describe-snapshots doesn't match Progress indicated in the AWS Console synchronously...

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