Created
April 15, 2016 21:55
-
-
Save reganjohnson/60f9fd58caa411850b389eac324c3e2d to your computer and use it in GitHub Desktop.
Mount EBS using ElasticBeanstalk ebextensions
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
container_commands: | |
01_clear_if_mounted: | |
command: 'if ! mount | grep /media/ebs_volume > /dev/nul; then rm -rf /media/ebs_volume; fi' | |
02_attach_volume: | |
command: 'aws ec2 attach-volume --region us-east-1 --volume-id vol-98654c46 --instance-id $(curl -s http://169.254.169.254/latest/meta-data/instance-id) --device /dev/sdh' | |
test: '[ ! -b /dev/sdh ]' | |
03_twiddle_fingers: | |
command: 'sleep 15' | |
04_make_dir: | |
command: 'mkdir /media/ebs_volume' | |
test: '[ ! -d /media/ebs_volume ] && echo "ebs_volume not created"' | |
05_try_mount: | |
command: 'mount /dev/sdh /media/ebs_volume' | |
test: '[ ! mountpoint -q /dev/sdh ] && echo "mountpoint not setup"' | |
06_format_if_not_already: | |
command: 'if find /media/ebs_volume/ -maxdepth 0 -empty | read v; then mkfs -t ext3 /dev/sdh; fi' | |
07_mount: | |
command: 'mount /dev/sdh /media/ebs_volume' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment