All About AWS EFS and other AWS Storage Options
Let us start by taking a look on current AWS storage options:
- AWS S3
A great solution for object storage, it's created in a specific region but still you can list all the buckets from the console while loged to any of the regions, both http and https protocols can be used with it, there is no need to worry about copying your data between data centers as this is already done in the background, you can use the Cross Region Replication feature to copy the data to different regions, there is another AWS S3 RRS available which guarantee a 99.99 uptime while the standard S3 is 99.99999, S3 storage can be used to host static websites and work standalone for that.Can You Mount S3 on EC2 server Instance ? Yes you can by using s3fs via FUSE which is not built by Amazon.AWS EBS
- This is like a NAS block storage service by AWS, it can be used into volumes as a standard Linux or Windows storage, EBS cannot be used in other region but you still can copy a snapshot to another region and create a new EBS out of it, EBS can be encrypted but it's not by default.
- Amazon Glacier
This is the most affordable solution but it comes in some costs like you cannot download the data at any time but you have to initial a request and start retrieving when it's ready, like S3 you don't need to make copies in different zones as it's done for you in the background, there is no minimum or maximum limit for the amount of data which you can store, Amazon Glacier prices differ from a region to a region so you need to put that in considerations while doing your estimates, it gives up to 10GB monthly data transfer for free, data is encrypted by default and secure, Multi-part option can be used whenever you are uploading 100MB+ data which will speed up the transfer, you cannot delete Glacier vault unless it's empty and free of data and you can create up to 1000 vaults per account.
What is AWS EFS
Amazon Elastic File System or AWS EFS provides a very simple out of the box scalable file storage, the size of efs is increasing and decreasing automatically based on the need and your usage, you can mount that storage type on multiple of EC2 servers which is not the case with other storage.
Create EFS And Mount It
- Login to your console
- Search for EFS service inside AWS services search box
- Select 'create EFS'
- Select VPC and the availability zones you want to enable for your EFS 'Be sure to attache a security group which has the NFS port opened'.
- Add tags if needed.
- Choose MAX I/O if EFS will be attached to 20-100+ instances with high frequency access otherwise choose general purpose.
- Review configuration and select 'Create File System'.
- It takes sometimes to be created in all zones, once it's done it will show green 'Available' text under 'Life cycle state' column.
- Copy the DNS name which will be used for mounting purpose.
Mount EFS on EC2 instance
- Connect to your EC2 instance "For this tutorial i am using a RedHAT 7 box"
- Install nfs utilities
yum -y install nfs-utils
- Create a folder to use it as an EFS mounting point.
- Run below mount command by replacing both the folder name and the DNS name with the ones you have.
mount -t nfs4 fs-xxxxxxxxxx.efs.us-east-1.amazonaws.com:/ /home/ec2-user/myMount
Confirm the mount
df -hT /home/ec2-user/myMount
Above command should give an output shows that folder is pointed and mounted to the EFS using nfs4.
To mount the EFS permenantly or have it mounted when system is rebooted you need to add the mount to you /etc/fstab
- vi /etc/fstab
- fs-xxxxxxxxxx.efs.us-east-1.amazonaws.com:/ /home/ec2-user/myMount nfs4 _netdev 0 0