Last active
December 17, 2020 15:17
-
-
Save sgnn7/d27fb0ab6e2cb29d466198ced9ea93df to your computer and use it in GitHub Desktop.
Revisions
-
sgnn7 revised this gist
Feb 27, 2017 . No changes.There are no files selected for viewing
-
sgnn7 created this gist
Feb 27, 2017 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ #!/bin/bash -e EC2_REGION="us-west-1" DEFAULT_PROGRESS_WAIT=5 # ========== SNAPSHOT WAIT ============== snapshot_id="snap-testtesttest" while [ "$snapshot_progress" != "100%" ]; do sleep "$DEFAULT_PROGRESS_WAIT" snapshot_progress=$(aws ec2 describe-snapshots --region $EC2_REGION \ --snapshot-ids "$snapshot_id" \ --no-paginate \ --query "Snapshots[*].Progress" \ --output text) echo "Snapshot progress: $snapshot_id $snapshot_progress" done aws ec2 wait snapshot-completed --region $EC2_REGION \ --snapshot-ids "$snapshot_id" echo "- Snapshot done: $snapshot_id" # ========== VOLUME WAIT ============== new_volume_id="vol-testtesttest" while [ "$volume_status" != "available" ]; do sleep "$DEFAULT_PROGRESS_WAIT" volume_status=$(aws ec2 describe-volumes --region $EC2_REGION \ --volume-ids "$new_volume_id" \ --no-paginate \ --query "Volumes[*].State" \ --output text) echo "Volume progress: $new_volume_id $volume_status" done aws ec2 wait volume-available --region $EC2_REGION \ --no-paginate \ --volume-ids $new_volume_id echo "- Volume ready: $new_volume_id"