AWS EFS Mount Script Example

This is an example of a bash shell script to mount an AWS Elastic File System (EFS) to an Ubuntu instance.  You can add this to the User Data section when launching new server.

#!/bin/bash
apt-get update
apt-get install -y nfs-common
echo "$(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone).fs-0000000.efs.us-west-2.amazonaws.com:/    /efs/data   nfs4    defaults" >> /etc/fstab
mkdir /efs
chmod go+rw /efs
mkdir /efs/data
chmod go+rw /efs/data
mount -a
Example EFS Mount Script

Replace fs-0000000 on line 5 with your file system ID.

This is just an example.  Use it at your own risk.

Follow by Email
Facebook
Google+
http://cloudlady911.com/index.php/2016/08/05/aws-efs-mount-script-example/
LinkedIn

Leave a Reply

Your email address will not be published. Required fields are marked *