0% found this document useful (0 votes)
6 views

Mount Elastic File System (EFS) On EC2

elastic EFS

Uploaded by

aqui.ti.mdw
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Mount Elastic File System (EFS) On EC2

elastic EFS

Uploaded by

aqui.ti.mdw
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

8/7/23, 9:24 AM Mount Elastic File System (EFS) on EC2

Home / AWS / Guided Lab / Mount Elastic File System (EFS) on EC2

Mount Elastic File System (EFS) on EC2


Level: Intermediate

Amazon EC2 Amazon Web Services Amazon Elastic File System

e 0h 59m 4s left
End Lab

Open Console

Validation

Lab Credentials

User Name x
Whiz_User_16857.12847163 w
Password x
26aeb114-3d18-4ec0-91c2-d96612cd28bf w
Access Key x
AKIAR7S7OT3L5INPG4GU w
Secret Key x
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 w
Lab Resources

No Lab Resources Found

Support Documents

Privacy - Terms

https://www.whizlabs.com/labs/mount-elastic-file-system-efs-on-ec2 1/11
8/7/23, 9:24 AM Mount Elastic File System (EFS) on EC2

1. FAQs and Troubleshooting

2. SSH into EC2 Instance

3. Labs - Instructions and Guidelines

4. SSH into EC2 Instance using Putty

5. What to do if your Putty session times out

Need help?

How to use Hands on Lab

Troubleshooting Lab

FAQs

Submit Feedback Share

Lab Overview Lab Steps Lab Validation

Cloud Architect, Cloud Developer, Cloud Administrator

Storage

Lab Steps
Task 1: Sign in to AWS Management Console

1. Click on the Open Console button, and you will get redirected to AWS Console in a
new browser tab.

2. On the AWS sign-in page,

Leave the Account ID as default. Never edit/remove the 12 digit Account ID


present in the AWS Console. otherwise, you cannot proceed with the lab.

Now copy your User Name and Password in the Lab Console to the IAM
Username and Password in AWS Console and click on the Sign in button.

3. Once Signed In to the AWS Management Console, Make the default AWS Region as US
East (N. Virginia) us-east-1.

https://www.whizlabs.com/labs/mount-elastic-file-system-efs-on-ec2 2/11
8/7/23, 9:24 AM Mount Elastic File System (EFS) on EC2

Note : If you face any issues, please go through FAQs and Troubleshooting for Labs.

Task 2: Launching two EC2 Instances

1. Make sure you are in the N.Virginia Region.

2. Navigate to the Services menu in the top, then click on EC2 in the Compute section.

3. Click on Instances from the left side bar and then click on Launch instances.

4. Number of Instances : Enter 2 on the right side under summary

5. Name : Enter MyEC2

6. For Amazon Machine Image (AMI): Search for Amazon Linux 2 AMI in the search box
and click on the Select button.

7. For Instance Type: select t2.micro

8. For Key pair: Select Create a new key pair Button

Key pair name: MyEC2Key

Key pair type: RSA

Private key file format: .pem

https://www.whizlabs.com/labs/mount-elastic-file-system-efs-on-ec2 3/11
8/7/23, 9:24 AM Mount Elastic File System (EFS) on EC2

9. Select Create key pair Button.

10. In Network Settings Click on Edit:

Auto-assign public IP: Enable

Select Create new Security group

Security Group Name: Enter EFS Security Group

To add SSH:

Choose Type: SSH

Source: Anywhere

For NFS:

Click on Add security group rule

Choose Type: NFS

Source: Anywhere

11. Keep Rest thing Default and Click on Launch Instance Button.

12. Select View all Instances to View Instance you Created

13. Launch Status: Your instance is now launching. Click on the instance ID and wait until
the initialization status changes to Running.

14. Click on each instance and enter a names as MyEC2-1 and MyEC2-2.

15. Take note of the IPv4 Public IP Addresses of the EC2 instances and save them for later.

Task 3: Creating an Elastic File System

1. Navigate to EFS by clicking on the Services menu at the top. Click on EFS in
the Storage section.

2. Click on Create file system

3. Click on Customize button.

https://www.whizlabs.com/labs/mount-elastic-file-system-efs-on-ec2 4/11
8/7/23, 9:24 AM Mount Elastic File System (EFS) on EC2

4. Enter the details below, Type the Name as EFS-Demo and make
sure default VPC and default Regional options are selected.

5. Uncheck the option of Enable automated backups

6. Leave everything by default and click on the Next button present below.

7. Network Access:

VPC

An Amazon EFS file system is accessed by EC2 instances running inside one
of your VPCs.

Choose the same VPC you selected while launching the EC2 instance (leave
as default).

Mount Targets

Instances connect to a file system by using a network interface called a


mount target. Each mount target has an IP address, which we assign
automatically or you can specify.

We will select all the Availability Zones (AZ’s) so that the EC2 instances
across your VPC can access the file system.

Select all the Availability Zones, and in the Security Groups, select EFS
Security Group instead of the default value.

Make sure you remove the default security group and select the EFS Security
Group, otherwise you will get an error in further steps.

Click on Next button

https://www.whizlabs.com/labs/mount-elastic-file-system-efs-on-ec2 5/11
8/7/23, 9:24 AM Mount Elastic File System (EFS) on EC2

8. File system policy - optional let it be optional only. Click on Next button

9. Review and Create: Review the configuration below before proceeding to create
your file system. Click on Create button.

10. Congratulations on creating the EFS File system, It's time to mount your EC2 Instance
with the EFS File system.

Task 4: Mount the File System to MyEC2-1 Instance

1. Select the MyEC2-1 Instance and copy the IPv4 Public IP.

2. SSH into the EC2 Instance

Please follow the steps in SSH into EC2 Instance.

3. Switch to root user

https://www.whizlabs.com/labs/mount-elastic-file-system-efs-on-ec2 6/11
8/7/23, 9:24 AM Mount Elastic File System (EFS) on EC2

sudo -s
w
4. Run the updates using the following command:

yum -y update
w
5. Install the NFS client as amazon-efs-utils.

yum install -y amazon-efs-utils


w
6. Create a directory by the name efs

mkdir efs
w
7. We have to mount the file system in this directory.

8. To do so, navigate to the AWS console and click on the created file system. On the
top-right corner, click on Attach

Copy the command of Using the EFS mount helper.

sudo mount -t efs -o tls fs-2ad0a9a8:/ efs


w
Note: fs-2ad0a9a8 is file system id in my case, it could be different in your case,
make sure to replace it.

9. To display information for all currently-mounted file systems, we'll use the command
bellow:

df -h
w

10. Create a directory in our current location:

https://www.whizlabs.com/labs/mount-elastic-file-system-efs-on-ec2 7/11
8/7/23, 9:24 AM Mount Elastic File System (EFS) on EC2

mkdir aws
w

Task 5: Mount the File System to MyEC2-2 Instance

1. Select the MyEC2-2 Instance and copy the IPv4 Public IP.

2. SSH into the EC2 Instance

Please follow the steps in SSH into EC2 Instance.

3. Switch to root user

sudo -s
w
4. Run the updates using the following command:

yum -y update
w
5. Install the NFS client as amazon-efs-utils.

yum -y install amazon-efs-utils


w
6. Create a directory with the name efs

mkdir efs
w
7. We have to mount the file system in this directory.

8. To do so, navigate to the AWS console and click on the created file system. On the
top-right corner, click on Attach

Copy the command of Using the EFS mount helper.

sudo mount -t efs -o tls fs-2ad0a9a8:/ efs


w
Note1: fs-2ad0a9a8 is file system id in my case, it could be different in your case,
make sure to replace it.

https://www.whizlabs.com/labs/mount-elastic-file-system-efs-on-ec2 8/11
8/7/23, 9:24 AM Mount Elastic File System (EFS) on EC2

Note2: In the above command we see, it starts with "sudo" since you are already a
super-user, it's ok, if you don't remove sudo.
To display information for all currently mounted file systems, we'll use the command

df -h

Task 6: Testing the File System

1. SSH into both instances in a side-by-side view on your machine, if possible.

2. Switch to root user

sudo -s
w
3. Navigate to the efs directory in both the servers using the command

cd efs
w
4. Create a file in any one server.

touch hello.txt
w
5. Check the file using the command

ls -ltr
w
6. Now go to the other server and give the command

cd efs
w
7. You can see the file created on this server as well. This proves that our EFS is working.

8. You can try creating files (touch command) or directories (mkdir command) on
other servers to continue to grow the EFS implementation.

https://www.whizlabs.com/labs/mount-elastic-file-system-efs-on-ec2 9/11
8/7/23, 9:24 AM Mount Elastic File System (EFS) on EC2

Do you Know ?
EFS uses the Network File System (NFS) protocol, which enables EC2 instances to mount
EFS as a network file system, providing a common data source for applications running
on multiple instances.

Task 7: Validation Test

1. Once the lab steps are completed, please click on the Validation button on the left
side panel.

2. This will validate the resources in the AWS account and displays whether you have
completed this lab successfully or not.

3. Sample output :

Completion and Conclusion


https://www.whizlabs.com/labs/mount-elastic-file-system-efs-on-ec2 10/11
8/7/23, 9:24 AM Mount Elastic File System (EFS) on EC2

1. You have successfully created an Elastic File System.

2. You have successfully created 2 Amazon Linux instances.

3. You have successfully installed the NFS Client and mounted EFS to the instances.

4. You have successfully tested the file-share between both Instances.

End Lab
1. Sign out of AWS Account.

2. You have successfully completed the lab.

3. Once you have completed the steps, click on End Lab from your whizlabs dashboard.

About Us Subscription Instructions and Guidelines FAQ’s Contact Us

© 2023, Whizlabs Software Pvt. Ltd. a f h

https://www.whizlabs.com/labs/mount-elastic-file-system-efs-on-ec2 11/11

You might also like