# Creating an Amazon EFS File System

Amazon Elastic File System (Amazon EFS) provides serverless, fully elastic file storage so that you can share file data without provisioning or managing storage capacity and performance. Amazon EFS is built to scale on demand to petabytes without disrupting applications, growing and shrinking automatically as you add and remove files.

The service is designed to be highly scalable, highly available, and highly durable.

## **Task 1: Creating a security group to access EFS file system**

The security group that we associate with a mount target *must allow inbound access for* ***TCP on port*** ***2049*** *for Network File System (NFS)*. This is the security group that we will now create, configure, and attach to your EFS mount targets.

* At the top of the AWS Management Console, in the search box, search for and choose `EC2.`
    
* In the navigation pane on the left, choose **Security Groups**.
    
* Choose **Create security group** then configure:
    
    * **Security group name:** `EFS Mount Target`
        
    * **Description:** `Inbound NFS access from EFS clients`
        
    * Select the **VPC**
        
    * Under the **Inbound rules** section, choose **Add rule** then configure:
        
        * **Type:** *NFS*
            

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1735622741892/338e526a-cd7e-4b3d-b031-9586778eda68.png align="center")

## **Task 2: Creating an EFS file system**

EFS file systems can be mounted to multiple EC2 instances that run in different Availability Zones in the same Region. These instances use *mount targets* that are created in each *Availability Zone* to mount the file system

* At the top of the AWS Management Console, in the search box, search for and choose `EFS`.
    
* Choose **Create file system**.
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1735622149157/0fa2270e-da6a-4079-8ceb-e36a7e13bc29.png align="center")

* In the **Create file system** window, choose **Customize**.
    
    * Uncheck Enable Automatic backups.
        
    * **Lifecycle management**:
        
        * for **Transition into IA** Select *None*.
            
    * In the **Tags** *optional* section, configure:
        
        * **Key:** <mark>Name</mark>
            
        * **Value:** <mark>MY First EFS File System</mark>
            
        * Attach the **EFS Mount Target** security group to each *Availability Zone* mount target by choosing **EFS Mount Target** for each Availability Zone.
            

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1735622222503/aeaa7ae2-926e-45b5-a153-fb318df075b9.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1735622552363/eb0bece2-adf8-4165-9b8e-eee66ee9393f.png align="center")

## **Task 3: Creating a new directory and mounting the EFS file system**

* In your EC2 terminal session, run the following command to install the required utilities:
    
    ```bash
    sudo su -l ec2-user
    sudo yum install -y amazon-efs-utils
    sudo mkdir efs
    ```
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1735623164110/034f2492-d3cc-4854-9426-b8c2fb8726fc.png align="center")

* At the top of the AWS Management Console, in the search box, search for and choose **EFS.**
    
* Choose **My First EFS File System**.
    
* In the **Amazon EFS Console**, on the top right corner of the page, choose **Attach** to open the Amazon EC2 mount instructions.
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1735623219860/e17c816b-2cbb-49b7-a6db-4b01a5af53e6.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1735623325213/fb89fc67-425a-4e28-a2a6-d9580824d279.png align="center")

* Copy the above **NFS client** section and paste it in your terminal to mount the EFS with the system.
    
* **df -hT** to view the disk usage in the system, you can see the Type nfs4 with &lt;ip address&gt; in the file system.
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1735623487697/1dce0370-0a20-4e50-a807-dd5fa5c6e143.png align="center")

## **Task 4: Examining the performance behavior of your new EFS file system**

### Examining the performance by using Flexible IO

Flexible IO (fio) is a synthetic I/O benchmarking utility for Linux. It is used to benchmark and test Linux I/O subsystems.

```bash
sudo fio --name=fio-efs --filesize=10G --filename=./efs/fio-efs-test.img --bs=1M --nrfiles=1 --direct=1 --sync=0 --rw=write --iodepth=200 --ioengine=libaio
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1735623842105/833a9a63-8175-4d02-81f5-8dfedf9b2e0f.png align="center")

### **Monitoring performance by using Amazon CloudWatch**

* At the top of the AWS Management Console, in the search box, search for and choose **CloudWatch**.
    
* In the navigation pane on the left, choose **All Metrics.**
    
* In the All metrics tab, choose **EFS.**
    
* Choose **File System Metrics.**
    
* Select the row that has the **PermittedThroughput** Metric Name.
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1735623905390/8799f688-ebf5-4f9c-914c-834bd19b27fc.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1735623973429/b06ce6c4-2187-4952-8eef-6af44e01938e.png align="center")

* Choose the **Graphed metrics** tab.
    
* On the Statistics column, select **Sum**.
    
* On the Period column, select **1 Minute**.
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1735624277959/08d15c22-05da-494b-a75d-439cbff39c8d.png align="center")

### Congratulations!!!

You created an EFS file system, mounted it to an EC2 instance, and ran an I/O benchmark test to examine its performance characteristics.
