Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save berga/15bfad3d1bb7e9ab70f224158254f9be to your computer and use it in GitHub Desktop.
Save berga/15bfad3d1bb7e9ab70f224158254f9be to your computer and use it in GitHub Desktop.
Amazon EC2 - user data to automatically mount an Amazon EFS file system at boot (Linux)
#cloud-config
package_upgrade: true
packages:
- nfs-utils
- httpd
- php
runcmd:
- echo "$(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone).FILE_SYSTEM_ID.efs.us-west-2.amazonaws.com:/ /var/www/html/efs nfs4 defaults" >> /etc/fstab
- mkdir /var/www/html/efs
- mount -a
- service httpd start
- chkconfig httpd on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment