In the previous (Introductory) part of Amazon Elastic File System (Amazon EFS) we learned different file storage, AWS EFS and some of its benefits.
In this part I’ll give you a quick demo of how to create and use EFS.
Setting up Amazon Elastic File System
For using any AWS service you need an AWS account. Here we are assuming that you have set up the AWS account, if not visit AWS Console to create an account. Following steps will show you, how you can create and use elastic file system.
Step -1 Firstly let’s create two ec2 instances, and storage will be shared between these two instances. Create only Linux instances because EFS does not support windows operating system.
- For just practise, use only t2.micro because its free.
- Take subnet-1a for the first instance, and choose subnet-1b for second instance.
- After selecting subnet click on next.
- When you come across Configure Security Group click on Add Rule.
- Add new rule name NFS.
- Change Source from Custom to Anywhere for both the rules.
- Click on Review & Launch.
- Create a new key pair and Launch.
Step -2 Similarly create second instance and under Configure Security Group choose the security group that we have created before.
- For this instance select existing pair key and choose key pair that we’ve created while creating first instance.
- Rename both the instance to differentiate.
Step -3 Search for EFS in search box and click on it.
- Click on Create file system.
- Keep everything default and click on Customize.
- After that click Next.
- Remove the default Security Groups and Add Security Group that we’ve created in starting.
- Click on Next and Create.
- Your File System will get created.
Step -4 Now access both your instances through terminal.
- Give sudo priviledges to both the instance by running sudo su command.
- Create a directory in both the instances using mkdir efs.
- Run yum install -y amazon-efs-utils to install utilities.
Step -5 Go to EFS. Click on File System you have created.
- Click on Attach.
- Copy command under Using the EFS mount helper.
- Run the command on both the instances.
- Now when you create any file in one instance it will automatically shown in another instance.
This is how you will create Elastic File System. After completing your hands-on part, make sure to delete both of your instances and file system as well.
This is the quick demo of Elastic file System. There are options/features that are available in EFS which I’ve skipped for this demo. Make sure to go through all of that options.
Hope you like this article.