Skip to main content
Launch this lab in the IP Lab Portal, then follow the steps below in the AWS console. Open IP Lab Portal

Overview

Lab details

  1. This lab walks you through the steps to create an Elastic File System.
  2. You will launch and configure two Amazon EC2 Instances.
  3. You will practice mounting the EFS to both instances by logging into each instance via SSH authentication.
  4. You will practice sharing files between two instances.
  5. Duration: 1 hour
  6. AWS Region: US East (N. Virginia) us-east-1

Architecture diagram

Task details

  1. Sign in to AWS Management Console
  2. Launching 2 EC2 instances.
  3. Create an Elastic File System.
  4. Mount the file system to MyEC2-1 Instance
  5. Mount the file system to MyEC2-2 Instance
  6. Testing the file system
  7. Validation of the lab.

Launching the lab environment

  1. To launch the lab environment, Click on the Launch lab button.
  2. Please wait until the cloud environment is provisioned. It will take less than a minute to provision.
  3. Once the Lab is started, you will be provided with IAM user name, Password, Access Key, and Secret Access Key.
You can only start one lab at any given time

Lab guide

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.
If you face any issues, please go through FAQs and Troubleshooting.

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 2023 kernel-6.1 AMI in the search box and click on the Select button.
  7. For Instance Type: select t2.micro
  1. For Key pair: Select Create a new key pair Button
    • Key pair name: MyEC2Key
    • Key pair type: RSA
    • Private key file format: .pem
  2. Select Create key pair Button.
  3. 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:
      1. Choose Type: SSH
      2. Source: Anywhere
    • For NFS:
      1. Click on Add security group rule
      2. Choose Type: NFS
      3. Source: Anywhere
  1. Keep Rest thing Default and Click on Launch Instance Button.
  2. Select View all Instances to View Instance you Created
  3. Launch Status: Your instance is now launching. Click on the instance ID and wait until the initialization status changes to Running.
  4. Click on each instance and enter a names as MyEC2-1 and MyEC2-2__.
  5. 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.
  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.
    • Scroll down to ‘Mount Targets’, then click on ‘Add Mount Target’. Select the availability zone and change the security group to EFS Security Group.
    • 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
  1. File system policy - optional let it be optional only. Click on Next button
  2. Review and Create: Review the configuration below before proceeding to create your file system. Click on Create button.
  3. 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
  1. Switch to root user
  2. Run the updates using the following command:
  3. Install the NFS client as amazon-efs-utils.
  4. Create a directory by the name efs
  5. We have to mount the file system in this directory.
  6. 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.
  • Note: Replace <dns name of EFS> with the DNS of the Elastic File System you’ve created.
  1. To display information for all currently-mounted file systems, we’ll use the command bellow:
  1. Create a directory in our current location:

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
  1. Switch to root user
  2. Run the updates using the following command:
  3. Install the NFS client as amazon-efs-utils.
  4. Create a directory with the name efs
  5. We have to mount the file system in this directory.
  6. 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.
    Note: Replace <dns name of EFS> with the DNS of the Elastic File System you’ve created.
  • To display information for all currently mounted file systems, we’ll use the command

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
  3. Navigate to the efs directory in both the servers using the command
  4. Create a file in any one server.
  5. Check the file using the command
  6. Now go to the other server and give the command
  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.
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 Check my work 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

  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 in the IP Lab Portal.

What gets checked

When you press Check my work, the platform verifies each of these:
  • Launch an EC2 Instance — Check whether an EC2 Instance is launched or not.
  • Launch EC2 AMI type Amazon Linux — Check whether the EC2 instance is launched using an Amazon AMI.
  • Create Elastic File system — Check whether Elastic File system is created or not.