Learn AWS [Amazon Web Services]

Dipali Kulshrestha
3 min readJul 4, 2020

--

Amazon EFS (Elastic File System) Set-up

Amazon Elastic File System (Amazon EFS) Cloud native data store provides a simple, scalable, fully managed elastic Network File System[NFS] for Linux based business applications. It provides simple, scalable file storage for use with Amazon EC2. With Amazon EFS, storage capacity is elastic, growing and shrinking automatically as you add and remove files.

Amazon EFS has a simple web services interface that allows you to create and configure file systems quickly and easily and make it available with one or more VPCs.

EC2 instance can then mount file system to store and access data. You can also mount on premise servers to EFS using AWS Direct Connect or VPN making it easy to migrate data and enable cloud boosting or backup your on prem data to EFS. For less frequently accessed data you can configure EFS to store data in IA storage class.

Mount Targets:

To access Amazon EFS in a VPC, you create one or more mount targets in the VPC. A mount target provides an IP for an NFS endpoint at which you can mount EFS. You can create only one mount target in each AZ, if there are multiple subnets in an AZ in your VPC, then you can create mount target in one of the subnets. Then all EC2 in that AZ share that mount target. You can mount an EFS in your VPC through the Network File system versions 4.0 and 4.1 (NFSv4) protocol [Default port 2049]

Let’s get in action!!

Step1: Create a Security Group to apply to the EFS Mount targets. And add NFS for 0.0.0.0/0

Step2: Create the file system and choose the AZs you will create mount targets (recommended by AWS to create in all AZs)

In Configure File system settings page, Keep everything Default, tick on Enable encryption at rest

No changes to configure client access. Review and Create file system.

Step3: Create two EC2 instances (in same region but in 2 diff AZs), Start HTTPD by adding boot script in Userdata section in 2 different Azs, and open port 80 in both the instances.

#!/bin/sh
sudo yum update -y
sudo yum install httpd -y
sudo service httpd start
chkconfig httpd on

Step 4: Mount EFS file system to the Linux instances @/var/www/html and create index.html on one of the instances.

Log-in to the ec2 instances and follow the mount instructions Amazon EC2 mount instructions (from local VPC)

sudo yum install -y amazon-efs-utilssudo mount -t efs -o tls fs-1xxxxxxb:/ /var/www/html

Step 5: Create a file index.html ONLY AT ONE INSTANCE

echo "This is on an EFS file system" > /var/www/html/index.html

Step 6: browse both servers from public DNS, Same file is visible from both machines.

PS: Comment if it improvements and Applaud if useful.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Dipali Kulshrestha
Dipali Kulshrestha

No responses yet

Write a response