This article provides a general overview about AWS Elastic File System (EFS), also highlights few of key features of AWS EFS.


What is an AWS EFS and What is it Used For?

  • AWS EFS is introduced to assist users to create & mange the file-systems with minimal user intervention.
  • EFS features a very simple, scalable & server-less elastic file system that lets users to share data without worrying about provisioning or managing storage.
  • EFS can be used with AWS or any on-premises resources. It’s scalable to terabytes and can provide reliable data management across numerous applications.
  • Most of the use-cases include server-less apps, backups, big-data analytics, app development, content, media & entertainment and many more.


AWS EFS Features
  • As of now, EFS comes with two different regional storage classes.
    • Regional class can store data securely & durably within single region & across multiple availability zones (AZ). This is the most common class used.
    • One Zone storage class stores data redundantly within single AZ. This approach potentially reduce 47% of the cost compared with standard class. This class is recommended for data which doesn’t require multi-AZ resilience.
  • Also, users can further classify their data into one of the following storage classes.
    • Standard Access storage class is the default storage class. This is recommended for general use-case where data is being actively shared across multiple entities.
    • Infrequent Access storage class is recommend for files that are less accessed or managed. Make sure to use this if around 80% of files are less frequently accessed. This class has less durability than above standard class. Also, using this class significantly improves cost-savings around 40% compared to Standard class.
  • Users don’t need to worry about scalability as AWS takes care about the capacity planning. AWS in the background  makes sure to scale up or down based on the usage.
  • EFS also have an option to encrypt the data at-rest & in-transit. Also, AWS-IAM can be integrated to effectively manage the permissions to the users within AWS.

Lets get to the practicality of EFS by creating one and mounting EC2 instance to it. We are considering us-east-1(NV) for the following usage.

Creating EFS using Console
  • Log-in to AWS console and navigate to EFS dashboard here.
AWS Elastic File System

AWS Elastic File System

  • Let’s create a new file system by clicking on the Create File System.
  • Provide a name to the File-system & choose the VPC where the file-system needs to be created. Choose the storage class depending the needs of the data classification. We are going with Regional as of now.

  • You can further customize the settings options over here. Also create tags if necessary to identify your file-system.

  • The next step is to manage the network configuration of the file-system. By default, a mount target is defined which provides an endpoint at which users can mount an EFS to their devices. Typically, AWS assigns one mount target per AZ.

  • The next step is to manage access/security of the file-system. AWS provides few sets of default policies. Foe ex: enforce read-only access policy has the following policy content.
{
    "Version": "2012-10-17",
    "Id": "efs-policy-wizard-e40e3562-9d51-4387-905b-d9c4bff3346b",
    "Statement": [
        {
            "Sid": "efs-statement-4aa1fef9-8b13-4571-a156-8195963aa51b",
            "Effect": "Allow",
            "Principal": {
                "AWS": "*"
            },
            "Action": [
                "elasticfilesystem:ClientRootAccess",
                "elasticfilesystem:ClientMount"
            ],
            "Condition": {
                "Bool": {
                    "elasticfilesystem:AccessedViaMountTarget": "true"
                }
            }
        }
    ]
}




  • The Next step is the review tab and users can have a final look at the configuration before creating the file-system.
AWS Elastic File System

AWS Elastic File System


Mounting EC2 instance to EFS
  • SSH to the EC2 instance. We are currently using AWS-Linux2 ec2 instance.
  • amazon-efs-utils package needs to be installed to attach EFS with EC2. Update & then isntall the efs-utils using the following commands.
    • sudo yum update -y
      sudo yum install -y amazon-efs-utils
  • After successfully install efs-utils, create a directory where efs should be mounted in your system.
    • Update your Ec2 security group to allow inbound for NFS port (2049).
    • Make sure to allow EC2 SG in EFS SG.
    • Provide a EC2 role for EFS if you are trying to make any changes to the EFS other than writing & storing data/files.
  • Fetch the EFS name from the console and then run the following command updating your fs name below.
    • sudo mkdir efs
      sudo mount -t efs <fs_name_here>:/ efs
      
      
      
      
      
  • Now you can use your NFS for storing & managing files as you need.
  • EFS mount will not be attached when your machine is rebooted/stop-started. To make it mounted on every go, update the above command in /etc/fstab.

This article just provided few details on how to get started with AWS EFS. Give it a try and see yourself the nature of EFS and how it can assist you and your teams in enabling an effective data access & management patterns. We are working on more articles to get you more idea on how AWS services work. Please have a look at few awesome articles here….

AWS Lambda Queue
What’s in EC2 dashboard?
What are Lambda Triggers?

  • CloudySave is an all-round one stop-shop for your organization & teams to reduce your AWS Cloud Costs by more than 55%.
  • Cloudysave’s goal is to provide clear visibility about the spending and usage patterns to your Engineers and Ops teams.
  • Have a quick look at CloudySave’s Cost Caluculator to estimate real-time AWS costs.
  • Sign up Now and uncover instant savings opportunities.

AUTHOR

Nikhil Araga is working as a DevOps Engineer who works with Cloud Migrations & DevOps team. He is proud to be part of a team who religiously follow Agile and has a SHIFT-LEFT mindset. He is actively working to create multiple CI/CD pipelines & stable deployment patterns. His key areas of interests include, Cloud Security, FinOps and DevOps practices.