Exploring AWS !!
Day 8:
Introduction to EFS (Elastic File System):
Cloud based file storage service for applications and workloads that run in AWS public cloud.
Why? If our application is running on Amazon EC2 and needs a file system or any case where file system is needed.
EFS cannot connect to Windows, only to Linux.
For Windows, shared storage will be FSx.
Benefits: Highly available, Elastic, Shared FS, High performance.
Creating and Mounting EFS:
— Creating EFS:
- Open AWS, click on Services drop down, choose EFS.
- Choose Create FS.
- Choose Default VPC from VPC list.
- Tick off all checkboxes for Availability zones, and click Next.
- Name and tags.
- Select General Purpose and Bursting for High performance.
- Review file system properties once and then choose Create FS.
- Note FS ID.
— Mounting EFS onto an EC2 instance:
- Connect Ubuntu using Putty.
- Install NFS using:
sudo apt-get -y install nfs-common - Proceed with below commands:
sudo mkdir efs
sudo mount -t efs fs-abcd123456789ef0 efs/
cd efs
sudo mkdir getting-started
sudo chown ec20user getting-started
cd getting-started
touch test.txt
ls -al
— Connecting multiple instances with shared EFS:
- Create another EC2 instance(Ubuntu).
- Mount previously created EFS onto it.
- Create a file in EFS directory in second instance.
- Verify in first instance whether file created in second instance is available.
To check → Connect to putty using instance → On account search EFS → Create FS → Click on FS → View details → Attach → Mount via IP → enter zone → Copy command → mkdir efs → sudo apt-get -y install nfs-command → paste the commands.