Mounting EFS on EC2 instance (2024)

Please use the menu below to navigate the article sections:

  • Step 1. Create Your Security Groups
  • Step 2. Create our EFS file system.
  • Step 3. Migrate to the EC2 management console, launch our EC2 instance and mount our filesystem, then check this connection.
  • Step 4. ‘Configure Security Group’
  • AWS Training Courses
Mounting EFS on EC2 instance (1)

When we think about virtual machines in AWS, there is a service that comes to mind, and that is EC2. There are many different options for how to provision your EC2 instance, and there are also many different options for how you can configure storage for your EC2 Instance.

These different storage types have their pros and cons, but if you are looking to use a Network Attached file system in the cloud, and you want to benefit from an AWS Managed Service, you can use the Elastic File system to achieve your goals.

The Elastic File System (EFS) is a serverless, shared file system which you can mount multiple EC2 instances to. EFS automatically scales and shrinks on demand, and is designed to be a highly available and durable file storage solution for your EC2 instances.

In this tutorial, I am going to walk through how you can create and securely mount your very own EFS file system to your own EC2 instance, and test the connection between the EFS file system and the EC2 instance to ensure that the two are connected effectively.

Step 1. Create Your Security Groups

The first thing we need to do is create our Security Groups (two of them) one for each of the things that we are launching in this tutorial, our EC2 instance and our EFS file system.

Open the VPC dashboard and make your way to the Security Groups section from the left navigation pane. Once here select the ‘Create Security Group’ button in the top right corner This will open a new window for you in which you will make your Security groups.

The first security group will allow SSH full access to our EC2 instance to allow us to effectively connect our EC2 instance, and we will also allow any outbound creativity too – it should look like the image below and use the default VPC in whichever region you choose. Make sure for security purposes you include only your IP in the SSH inbound rule.

Mounting EFS on EC2 instance (2)

The second security group will be for the EFS file system, and you will need to allow Custom TCP traffic allows inbound traffic from your IP, using port 2409, and all outbound traffic. It will look like this.

Mounting EFS on EC2 instance (3)

Step 2. Create our EFS file system.

We will navigate to the EFS console within the AWS management console – and once we are here, click ‘Create Filesystem’.

I am calling my file system ‘EC2-Test’ and leave the initial defaults the same. Then click ‘Customize’ next to create.

Mounting EFS on EC2 instance (4)

We will leave the first page of options default and click next to take us to the ‘Network Access’ stage. Once on this page leave the default VPC as the selected option and select the checkboxes for all of the Availability Zones in whichever Region you use. Also, please make sure all mount targets use the default subnets and Automatic IP addresses. Also, remove the existing security groups, and add your pre-configured EFS security group to each mount target. I am using the us-east-1 region for this tutorial.

Mounting EFS on EC2 instance (5)

Then, click next. We will leave the defaults in place for the File System policy section for our purposes, however note that you can allow fine grained access to your EFS File System using file system policies. Click next again, and review our options and click Create.

After a few seconds, our File System should be available!

Mounting EFS on EC2 instance (6)

Make note of the file system ID on a separate notepad document so we can refer to it in the future.

Step 3. Migrate to the EC2 management console, launch our EC2 instance and mount our filesystem, then check this connection.

Once we are in the EC2 Management Console, find the ‘Launch Instance’ button, and select the Amazon Linux 2 AMI.

Mounting EFS on EC2 instance (7)

We then need to choose an Instance type – choose the t2.micro, which is the free tier option.

Mounting EFS on EC2 instance (8)

Once selected we will be Configuring the Instance Details.

Choose the default VPC, and for the subnet choose no preference.

Under File System, select ‘Add File System’ and it should automatically populate with the file system you have pre-configured in the previous steps in this tutorial – check the EFS system file id that we took note of in the previous step, and make sure it matches. Untick the box that asks us to automatically create and attach the correct Security Group. Note you can customize the path at which the file system will be mounted – however for this tutorial we shall leave it default, which is /mnt/efs/fs1.

Note also, that when you select the file system, it automatically populates the User Data so that the file system mounts automatically upon instance reboot, during a production environment.

We are then ready to move to the next stage. We will skip adding storage and tags.

Step 4. ‘Configure Security Group’

We are going to select the security group we made earlier – which is the EC2 Security group. Double check the rules and select ‘Review and Launch’.

Once you have reviewed the options, if you want to connect to the instance using anything other than EC2 instance connect, you will need to create a key pair. If you want to connect using EC2 instance connect however we will select ‘proceed without a key pair’ and click Launch Instances.

Once our instance state has transitioned to running, we will select the Instance and click ‘Connect’.

Mounting EFS on EC2 instance (9)

Once you have selected Connect, you should be automatically connected and you should see that you have logged into your instance with the login screen below.

Mounting EFS on EC2 instance (10)

You are now ready to run commands to check your EFS Filesystem is mounted to your EC2 instance.

The command that you will run is the following:

df -T -h

This command means the following. df means ‘disk free’ and is used to display the amount of available disk space for file systems. -T prints the filesystem type and -h makes it human readable.

When you run this command there will be a number of outputs, however you will see that in the default path (/mnt/efs/fs1) you will see our EFS File System attached, ready to use!

Mounting EFS on EC2 instance (11)

We have now successfully created our EC2 instance, and mounted our EFS file system on to it and verified the connection was successful.

AWS Training Courses

Amazon EC2 features in several of our AWS certification training coursesincluding the following:

  • AWS Certified Cloud Practitioner
  • AWS Certified Solutions Architect Associate
  • AWS Certified Developer Associate
  • AWS Certified SysOps Administrator Associate
  • AWS Certified Solutions Architect Professional

Related posts:

Mounting EFS on EC2 instance (2024)
Top Articles
Crypto Day Trading for Beginners |​​ Strategies & Common Mistakes
Apple or Microsoft? Here’s our comparison
Lowe's Garden Fence Roll
Swimgs Yuzzle Wuzzle Yups Wits Sadie Plant Tune 3 Tabs Winnie The Pooh Halloween Bob The Builder Christmas Autumns Cow Dog Pig Tim Cook’s Birthday Buff Work It Out Wombats Pineview Playtime Chronicles Day Of The Dead The Alpha Baa Baa Twinkle
Edina Omni Portal
Tmf Saul's Investing Discussions
Live Basketball Scores Flashscore
What Auto Parts Stores Are Open
Craigslist Pet Phoenix
Samsung 9C8
Delectable Birthday Dyes
Michaels W2 Online
Flower Mound Clavicle Trauma
Fairy Liquid Near Me
Arre St Wv Srj
Vistatech Quadcopter Drone With Camera Reviews
Dark Chocolate Cherry Vegan Cinnamon Rolls
Spider-Man: Across The Spider-Verse Showtimes Near Marcus Bay Park Cinema
Pay Boot Barn Credit Card
Ahrefs Koopje
Forest Biome
How your diet could help combat climate change in 2019 | CNN
Timeforce Choctaw
Yog-Sothoth
Filthy Rich Boys (Rich Boys Of Burberry Prep #1) - C.M. Stunich [PDF] | Online Book Share
Myql Loan Login
Lexus Credit Card Login
Access a Shared Resource | Computing for Arts + Sciences
Narragansett Bay Cruising - A Complete Guide: Explore Newport, Providence & More
Effingham Daily News Police Report
2004 Honda Odyssey Firing Order
CohhCarnage - Twitch Streamer Profile & Bio - TopTwitchStreamers
Lesson 1.1 Practice B Geometry Answers
Scat Ladyboy
Calculator Souo
Peter Vigilante Biography, Net Worth, Age, Height, Family, Girlfriend
Truckers Report Forums
Afspraak inzien
Chs.mywork
Pitchfork's Top 200 of the 2010s: 50-1 (clips)
Mydocbill.com/Mr
Aliciabibs
Adam Bartley Net Worth
20 bank M&A deals with the largest target asset volume in 2023
Restored Republic June 6 2023
Lima Crime Stoppers
Sams Gas Price Sanford Fl
Pulitzer And Tony Winning Play About A Mathematical Genius Crossword
Yakini Q Sj Photos
Diamond Desires Nyc
Jesus Calling Oct 6
Latest Posts
Article information

Author: Sen. Ignacio Ratke

Last Updated:

Views: 6155

Rating: 4.6 / 5 (76 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Sen. Ignacio Ratke

Birthday: 1999-05-27

Address: Apt. 171 8116 Bailey Via, Roberthaven, GA 58289

Phone: +2585395768220

Job: Lead Liaison

Hobby: Lockpicking, LARPing, Lego building, Lapidary, Macrame, Book restoration, Bodybuilding

Introduction: My name is Sen. Ignacio Ratke, I am a adventurous, zealous, outstanding, agreeable, precious, excited, gifted person who loves writing and wants to share my knowledge and understanding with you.