AWS EFS Practical: Hands-on Guide for Beginners
- CloudCastHub
- Aug 10, 2024
- 3 min read
AWS EFS is a top-notch file storage service from Amazon Web Services (AWS). It makes storing and managing data in the cloud easy and affordable. It works well with Amazon EC2 instances, on-premises servers, or in a mix of both.
What is AWS EFS?
AWS EFS lets you set up and manage file systems. Then, you can mount these on your Amazon EC2 instances. These file systems work across many EC2 instances at once. They're perfect for apps needing shared storage, like web servers and media processing.
Benefits of Using AWS EFS
Scalability: AWS EFS grows or shrinks your file system as you add or remove files. You don't need to plan for storage ahead of time.
High Availability: EFS file systems are built to be always available and last a long time. They keep data safe across several Availability Zones in a Region.
Easy to Use: Creating and managing an EFS file system is simple. You don't have to worry about managing storage servers.
Cost-Effective: You pay only for the storage you use. There are no upfront costs or minimum fees.
Secure: EFS has many security features. These include Amazon VPC, AWS IAM, and encryption for data at rest.
Using the benefits of AWS EFS, you can make storage easier, boost app performance, and focus on your work.
Setting Up AWS EFS
Prerequisites
An AWS account
Basic knowledge of AWS services
An Amazon EC2 instance running Linux
Step 1: Create an EFS File System
1. Sign in to the AWS Management Console and open the EFS console at https://console.aws.amazon.com/efs/.

2. Create a file system:
Click on "Create file system".

Select the VPC and subnets where you want to create the EFS.

Click on "Create".
Step 2: Configure Security Groups
Edit security groups:
Go to the EC2 console and select "Security Groups" from the sidebar.

Create a new security group or modify an existing one to allow inbound NFS traffic (port 2049).

Step 3: Mount the EFS File System
1. Connect to your EC2 instance:
Use SSH to connect to your Linux EC2 instance.
Install the EFS client if it’s not already installed `sudo yum install amazon-efs-utils` for Amazon Linux.

2. Mount the EFS file system:
Create a directory to mount the file system `mkdir efs`.

Open up the EFS instance and click on attach

Copy the EFS Mounter command from the attach option:

Mount the EFS file system by pasting the command on the EC2 instance:

Step 4: Verify the Mount
1. Check the mount:
Use the `df -h | grep efs` command to verify that the EFS file system is mounted.

You should see an entry for your EFS file system.
2. Test file operations:
Create a test file to verify that the file system is working correctly:

You should see the testfile in the directory.
Conclusion
You now know how to use AWS EFS in your cloud apps. You've learned how to set up and mount your EFS file system. This makes it easy to add EFS to your infrastructure.
FAQ
What is AWS EFS?
AWS Elastic File System (EFS) is a service by Amazon Web Services (AWS). It's for cloud-based apps. It's scalable, highly available, and durable for file storage.
What are the benefits of using AWS EFS?
AWS EFS helps you scale easily and keeps your data safe. It's easy to use for sharing data across many Amazon EC2 instances.
How do I set up an AWS EFS file system?
To set up AWS EFS, use the AWS Management Console. First, create a new file system. Then, set up the basic settings and check the network connection.
How do I mount an EFS file system on an Amazon Linux instance?
Mount an EFS file system on an Amazon Linux instance by installing the NFS client packages. Create a mount point and use the mount command to attach the EFS to your instance.
How do I create files and directories within my EFS file system?
After mounting your EFS file system, use Linux commands like touch and mkdir to create files and directories. These will be stored in the EFS, accessible to other instances.
How can I access the same files from multiple EC2 instances using EFS?
Mount the same EFS file system on many EC2 instances. This lets you share files and directories easily across your cloud apps.
Comentários