Created
July 1, 2019 06:21
-
-
Save sanudatta11/528cfbd759ca157994e510097da1710d to your computer and use it in GitHub Desktop.
Auto Remount on Reboot EFS
This file contains 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
#!/bin/bash | |
# mount EFS volume | |
# https://docs.aws.amazon.com/efs/latest/ug/gs-step-three-connect-to-ec2-instance.html | |
# create a directory to mount our efs volume to | |
"sudo mkdir -p /mnt/efs", | |
# mount the efs volume | |
"sudo mount -t nfs4 -o nfsvers=4.1 ${aws_efs_mount_target.efs-mount-target.dns_name}:/ /mnt/efs", | |
# create fstab entry to ensure automount on reboots | |
# https://docs.aws.amazon.com/efs/latest/ug/mount-fs-auto-mount-onreboot.html#mount-fs-auto-mount-on-creation | |
"sudo su -c \"echo '${aws_efs_mount_target.efs-mount-target.dns_name}:/ /mnt/efs nfs defaults,vers=4.1 0 0' >> /etc/fstab\"" #create fstab entry to ensure automount on reboots |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment