Tuesday, 16 April 2024

The goal of this lab is to illustrate how to create and share an NFS file system using AWS EFS service.

 

Architecture Diagram

lab-018-arch-01

Overview

Create two EC2 instances in different AZs (you can use public subnets). Create an NFS file system using EFS and mount it using one of the EC2 instances. Create some files for testing purposes. Then try to mount and access the file system from the other EC2 instance. Note that the access should work simultaneously.

Step 1 - VPC Setup

Make sure your VPC is configured to enable mounting using DNS names. You can do that by going to your VPC's action menu and selecting Edit DNS Resolution and Edit DNS Hostnames. Make sure both are set to Yes.

Step 2 - Create Security Group

Create a security group named nfs-access to allow access to the NFS file system to members of the security group.

First Create the security group. lab-018-scrn-01

Then edit its inbound rule to allow access from members of the group. lab-018-scrn-02

Step 3 - Launch EC2 Instances

Launch two EC2 instances, each on its own AZ. Use the user-data.sh to install Amazon's EFS utility package. Make sure your instances are members of the nfs-access security group and are also accessed via ssh.

Step 4 - Create an NFS File System

Go to Storage - EFS and click Create file sytem.

lab-018-scrn-03

Copy the EFS file system ID.

lab-018-scrn-04

Step 5 - Mount the NFS File System

Access one of the EC2 instances using ssh. Create a folder to be the mounting point (let's say data). Then using your EFS file system ID (mine was fs-9ee0b987) issue the command:

sudo mount -t efs fs-9ee0b987:/ data

You should be able to access the file system. Create a few testing files.

No comments:

Post a Comment