Skip to content

Instantly share code, notes, and snippets.

@imgeraldalinio
Created June 29, 2020 17:23
Show Gist options
  • Save imgeraldalinio/b39afa58d27ca31de2646cf66367f958 to your computer and use it in GitHub Desktop.
Save imgeraldalinio/b39afa58d27ca31de2646cf66367f958 to your computer and use it in GitHub Desktop.
#!/bin/bash
# To get your AWS Availability Zone where your EC2 instance located
AWS_AZ=$(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone)
# Modify your path mount folder directory
EFS_MOUNT_DIR=/home/ubuntu/efs
# Modify your own EFS endpoint
EFS_HOSTNAME=fs-xxxxxxxx.efs.us-west-2.amazonaws.com
# Do not replace this fstab directory
FSTAB_FILE=/etc/fstab
# Command to mount your EFS on fstab
$AWS_AZ.$EFS_HOSTNAME:/ $EFS_MOUNT_DIR nfs4 nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2 0 0 >> $FSTAB_FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment