File System in the cloud using Amazon EFS

File System in the cloud using Amazon EFS

AMAZON EFS (Elastic File System) :

Amazon Elastic File System is a cloud storage service provided by Amazon Web Services designed to provide scalable, elastic, concurrent with some restrictions, and encrypted file storage for use with both AWS cloud services and on-premises resources.

HOW IT WORKS :

Amazon Elastic File System (Amazon EFS) automatically grows and shrinks as you add and remove files with no need for management or provisioning.

No alt text provided for this image

HOW WE CAN USE IT :

We can use EFS file System as a common data source for workloads and applications running on multiple instances

TASK AVALIABLE :

  • Configure and deploy an Amazon Elastic File System
  • Mount EFS endpoint into EC2 Instances
  • Test if the file are accessible from EC2 instance

SOLUTION :

No alt text provided for this image

  • We have to check weather an instance is created and is in running state
  • Concept is amazon creates a shared storage file system available concurrently to multiple instances

No alt text provided for this image

1.) Now we will create security group after checking instances

NOTE : (you can add your default name, description, & VPC according to needs , I'm performing AWS cloud quest task soo I followed the steps given in the task)

No alt text provided for this image

After selecting the NFS as inbound rule you can create the security group and verify your security group name after creation of security group.

Concept behind this is (when we create Amazon EFS mount target we must attach security group. The security group determines which instances access the file system as NFS client, as shown in above pic)

  • After the Amazon EFS security group has been created, we are prepared to create the file system

No alt text provided for this image

2.) After creating security group search for EFS service in search menu and then click on (create file system) after that you will be forwarded to the screen as displayed above in the given pic

  • Name your file as you wish (it is optional)
  • Select the storage class as standard or one zone as you required, (selecting Standard storage class you can access storage data in multiple Availability Zones, my instances are in multiple availability zones so, I selected the standard storage class)
  • NOTE : (You can deselect automatic backups and lifecycle management to reduce cost until you are in production.) and then click on next.

No alt text provided for this image

3.) In network access select your availability zone, subnet ID & security group & then click on next button on the bottom of the screen

No alt text provided for this image

In file system policy create your policy if you wanted otherwise click on next as it is optional

No alt text provided for this image

After clicking on next check all the setting in review and create window and then click on next present on the right most bottom of the screen.

No alt text provided for this image

4.) When the file system is successfully created click on the file system name highlighted in blue colour

No alt text provided for this image

After opening the file system name click on attach highlighted in orange color in the screen

No alt text provided for this image

Click on copy button as given in above pic and then click on close button

No alt text provided for this image

5.) Now go on services search for EC2 service

After it select your first instance and then click on connect as given in above pic

No alt text provided for this image

Then click on connect

No alt text provided for this image

6.) In Amazon Linux 2 AMI first type the given command to install the amazon EFS utilities

COMMAND: sudo yum install -y amazon-efs-utils

No alt text provided for this image

Then type the given commands

1.) mkdir data

2.) ls

3.) In third command paste the mount command which was copied in earlier

4.) cd data

5.) sudo bash -c "(give name of file acc. to you) >> efs-1-setup.log"

or

sudo bash -c "efs-1-setup.log"

6.) efs-1 mounted site A

7.) ctrl c

8.) efs-1-setup.log

No alt text provided for this image


7.) After it we again go to EFS service and open the file system name on clicking the file system name

  • Then we go on network section and click on manage

No alt text provided for this image


Then firstly we on add mount target

  • Then we click on Availability zone and select the availability which we want to connect
  • Select the subnet ID which was given in the list by default accordingly to the instance
  • Then we select the security group and then click on save
  • After few minutes check the availability zone which we added

No alt text provided for this image

8.) Again go to EC2 service and then select the second instance which we want to connect

Then again click on connect button and type the command in Linux AMI

  • sudo yum install -y amazon-efs-utils

No alt text provided for this image

Then type the given commands again

1.) mkdir data

2.) ls

3.) paste the link again which we copied earlier using EFS mount helper

4.) cd data

5.) efs-1-setup.log (if you can see that efs-1 is mounted then our first EFS is already mounted now we have to mount the second)

6.) sudo bash -c "efs-1-setup.log"

7.) efs-1 is mounted in site B

8.) ctrl c

9.) efs-1-setup.log

If you can see that (efs-1 is mounted in site A & efs-1 is mounted in site B) that means our both EFS are connected

ALL THE TASK ARE COMPLETED

To view or add a comment, sign in

Others also viewed

Explore content categories