#!/bin/bash
### Configure Container Instances ###
# Install NFS client software on your container instance.
sudo yum install -y nfs-utils
# Create a mount point for your Amazon EFS file system.
sudo mkdir /efs
# Mount your file system
sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2 fs-b42ee9cd.efs.us-east-2.amazonaws.com:/ /efs
# Validate that the file system
mount | grep efs
# backup fstab
sudo cp /etc/fstab /etc/fstab.bak
# Update the /etc/fstab file to automatically mount the file system at boot.
echo 'fs-b42ee9cd.efs.us-east-2.amazonaws.com:/ /efs nfs4 nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2 0 0' | sudo tee -a /etc/fstab
# Reload the file system table to verify that your mounts are working properly.
sudo mount -a
# Restart Docker
sudo stop ecs
sudo service docker restart
sudo start ecs