Last active
August 29, 2015 14:01
-
-
Save linuxboytoo/f630d9ec02c4b2732420 to your computer and use it in GitHub Desktop.
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 characters
| ZONE=`curl http://169.254.169.254/latest/meta-data/placement/availability-zone` | |
| VOLUME=`aws ec2 create-volume --availability-zone=$ZONE --size=100|grep 'VolumeId'|awk -F'\"' '{print $4}'` | |
| INSTANCE=`curl http://169.254.169.254/latest/meta-data/instance-id` | |
| sleep 5 | |
| aws ec2 attach-volume --volume-id=$VOLUME --instance-id=$INSTANCE --device=/dev/sdn | |
| sleep 5 | |
| mkfs.ext4 /dev/xvdn | |
| mkdir -p /backup | |
| mount /dev/xvdn /backup | |
| innobackupex --slave-info --no-timestamp /backup/xtrabackup | |
| innobackupex --apply-log /backup/xtrabackup | |
| fsfreeze --freeze /backup | |
| aws ec2 create-snapshot --volume-id $VOLUME | |
| fsfreeze --unfreeze /backup | |
| umount /backup | |
| rm -rf /backup | |
| sleep 5 | |
| aws ec2 detach-volume --volume-id=$VOLUME | |
| sleep 10 | |
| aws ec2 delete-volume --volume-id=$VOLUME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment