Last active
July 9, 2019 15:07
-
-
Save BenHigginbottom/2eb3c55d88d3845b2cb2b1cb978f9091 to your computer and use it in GitHub Desktop.
EFS Userdata Mount
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 | |
EC2_AVAIL_ZONE=$(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone) | |
mount_target_DNS_a=`` | |
mount_target_DNS_b=`` | |
mount_target_DNS_c=`` | |
efs_mount_point=`` | |
case "$EC2_AVAIL_ZONE" in | |
eu-west-2a) echo "mounting eu-west-2a mount point" | |
mount -t nfs -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport "$mount_target_DNS_a":/ ~/"$efs_mount_point" | |
;; | |
eu-west-2b) echo "mounting eu-west-2b mount point" | |
mount -t nfs -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport "$mount_target_DNS_b":/ ~/"$efs_mount_point" | |
;; | |
eu-west-2c) echo "mounting eu-west-2c mount point" | |
mount -t nfs -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport "$mount_target_DNS_c":/ ~/"$efs_mount_point" | |
;; | |
*) echo "PANIC - Cannot determine AZ" | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment