HostOnNet Blog

Amazon Elastic File System

Amazon Elastic File System (Amazon EFS) a scalable file storage for use with Amazon EC2. This is a network file system, that you can mount on multiple EC2 instances to share your application files. Very useful when you need to load balance application in multiple ec2 instances.

You don’t have to worry about disk size as it grow as you need. You only need to pay for actual storage you use.

To create Amazon EFS, login to Amazon Console, go to EFS, select your region and click Create file system.

On next screen, you need to select VPC and Security Group. Make sure this is same as your EC2 instance or you will not able to connect.

Once you create file system, it will create file system on all of the availability zone in your region. For example, here i created file system in Region Ireland, it created file system in all 3 availability zones.

Click on the link “Amazon EC2 mount instructions” on your file system details page to get instructions to mount the file system on your Amazon EC2 instance.

First you need to install nfs client.

On ubuntu, run

sudo apt-get install nfs-common

To mount, run

sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2 DNS-NAME:/ /MOUNTPOINT

DNS-NAME = you can get this from file system details page.

MOUNTPOINT = Path to folder where you need to mount the file syste,

Example

ubuntu@ip-172-31-32-78:~$ sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2 eu-west-1b.fs-f965a630.efs.eu-west-1.amazonaws.com:/ /home/ubuntu/efs
ubuntu@ip-172-31-32-78:~$ 

Now lets test file system speed with dd command.

ubuntu@ip-172-31-32-78:~/efs$ sudo dd if=/dev/zero of=hon-test bs=64k count=16k conv=fdatasync && sudo rm -f hon-test
16384+0 records in
16384+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 17.0618 s, 62.9 MB/s
ubuntu@ip-172-31-32-78:~/efs$

Not that bad. For a local HDD, you get like 150 MB/s.


Posted in Cloud