Last active
November 25, 2020 23:49
-
-
Save brianlechthaler/dc45d166ec50e9bd917869b213363a24 to your computer and use it in GitHub Desktop.
Tool to automatically provision any AWS EFS attached to an EC2 instance running this script
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/sh | |
#Store the name of the user who invoked this script to set appropriate permissions later | |
export invokingUser=$(whoami) | |
echo "Usage: ./efs-bootstrap.sh <EFS_Filesystem_ID> <MountPoint>" | |
echo "Example: ./efs-bootstrap.sh fs-deadbeef /mnt/efs/fs1/" | |
#Ensure target directory exists | |
sudo mkdir -p $2 | |
#Attempt to mount EFS Filesystem, authenticating with IAM over TLS. | |
sudo mount -t efs $1:/ $2 -o tls,iam | |
#Attempt to set proper permissions on EFS directory | |
sudo chown -R $invokingUser:$invokingUser $2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment