Skip to content

Instantly share code, notes, and snippets.

@naoty
Created January 4, 2012 06:59
Show Gist options
  • Save naoty/1558878 to your computer and use it in GitHub Desktop.
Save naoty/1558878 to your computer and use it in GitHub Desktop.
create EBS snapshot
#!/bin/sh
volume="$1"
snapshot=`ec2-create-snapshot $volume | cut -f 2`
status="pending"
while [ "$status" = "pending" ]; do
sleep 300
status=`ec2-describe-snapshots $snapshot | cut -f 4`
done
if [ "$status" = "error" ]; then
echo "failed to create snapshot"
else
echo "completed to create snapshot"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment