EFS Configuration with EC2 Mounting It

Introduction

Steps to create EFS from console and mount EFS in EC2, main focus will be on EFS

Create security group for EFS

  • EFS is using NFS version 4.0 and 4.1, so we must create a security group to allow tcp 2049 port accessible to EFS
  • When creating security group for EFS, we can select the source allow to access EFS which the security group for EC2 will be selected
    efs

  • Finished SG view of EFS
    efs

Create EFS

  • Make sure the correct VPC, subnet and SG is selected
    efs

  • Remove the default SG and select the EFS SG
    efs

  • Rest of steps to complete EFS, configure accordingly
    efs
    efs

  • Finshed view of EFS configuring
    efs

  • EFS creating and finished
    efs
    efs

Steps to mount EFS to EC2

  • Follow the provided instructions
  • Install necessary package
    efs

  • Follow the instruction to mount the EFS mounting target
    efs

Login to EC2 and mount EFS mounting target

  • Install necessary package
    efs

  • Mount EFS mounting target
    efs

Mount EFS mounting target automatically after reboot

  • Modify /etc/fstab as bellow, reboot to confirm
      sudo sh -c "cat >> /etc/fstab"
      your_EFS_file_system_id mount_point efs defaults,_netdev 0 0
    

    efs

  • EFS auto mounted after reboot
    efs

Checking EFS statistics with CloudWatch

  • test and monitor EFS with command bloew, replace the mounting point
      sudo fio --name=fio-efs --filesize=10G --filename=/`ur_mount_point`/fio-efs-test.img --bs=1M --nrfiles=1 --direct=1 --sync=0 --rw=write --iodepth=200 --ioengine=libaio
    

    efs

  • Enter CloudWatch console
    efs

  • Select metrics to be monitor
    efs

  • Set configuration according to needs and check the result graphp above
    efs

Finished view of testing command

efs