If you are hosting on AWS EC2 and want to mount an Amazon EFS share to your server, follow these directions:
This is required for EFS support:
I recommend you run these commands in your home directory, but it can be done anywhere.
sudo dnf install git make rpm-build
git clone https://github.com/aws/efs-utils=
sudo make rpm
sudo dnf install ./build/amazon-efs-utils*rpm
Mount File Share
Here are a few placeholders you'll need to change to match your desired setup:
- /mount_dir - The directory you want the share to show up as
- fs-XXX - The filesystem ID of the EFS filesystem you're mounting
- fsap-YYY - The Access point ID of the filesystem. Found by selecting the filesystem and switching to the Access Points tab.
#First backup your fstab file in case you mess anything up:
sudo cp /etc/fstab /etc/fstab.bak
# Create the directory that you will be mounting the fileshare to
# Open the fstab file
sudo vim /etc/fstab
# Add the following line to the bottom of the fstab, remembering to replace the fs-XXX, mount_dir, and fsap-YYY values with your own
fs-XXX /mount_dir efs _netdev,tls,accesspoint=fsap-YYY 0 0
# Save and close Vim
# Verify it works
sudo mount -a
If the mount command is successful, you're done. The filesystem will automatically re-mount whenever the server reboots as well.
You can now cd into directory to read/write files.
Remember: when setting file permissions, Amazon EFS uses only the user and group IDs. This means if you are mounting the drive to multiple servers you need to take care to use the same user and group IDs on all servers. using the same names is not good enough.
You can specify the desired ID when setting up users and groups. For example:
groupadd -g 1003 apache
useradd -u 1502 -g 1502 myuser
In the above apache example, you'd need to do this before installing apache, otherwise the install process will assign it's own ID that you cannot control. It's not worth attempting to change IDs after they have been created. It's best to remove the user/group and start from scratch.