How to Create & Configure EFS(Elastic File System) on Amazon Web Service(AWS).
Amazon Elastic File System (Amazon EFS) provides a simple, scalable, fully managed, elastic NFS file system for use with AWS Cloud services and on-premises resources. Amazon EFS is easy to use and offers a simple interface that allows you to create and configure file systems quickly and easily.
With Amazon EFS, you can create a file system, mount the file system on an Amazon EC2 instance, and then read and write data to and from your file system. You can mount an Amazon EFS file system in your virtual private cloud (VPC), through the Network File System versions 4.0 and 4.1 (NFSv4) protocol.
- Login to aws portal.
- Click on Services.
- Under Storage select EFS.
- Click on Create File system.
- Provide file system name.
- Select existing Virtual private cloud(VPC).
- Select Availability zone: regional or one zone.
- Then click on Customize.
- Set the lifecycle(period of time) of EFS.
- If you want AWS KMS key so click on Create an AWS KMS key.
- AWS Key Management Service (KMS) is an Amazon Web Services product that allows administrators to create, delete and control keys that encrypt data stored in AWS databases and products.
- Provide tag name & value for EFS.
- Click on Next.
- Select existing VPC for network.
- Select Availablity zone, Subnet ID & Security group for mount targets.
- Click on Next.
- If you want to set policy on File system then select policy options in json format.
- Click on Next.
- Review all the configurations.
- Click on Create.
- After sometime EFS is ready.
- Click on New EFS name then click on Attach.
- First create a ec2 instance on aws acount so click on link https://www.hackerxone.com/blog/how-create-ec2-instance-amazon-web-serviceaws
- Login to ec2 instance with sudo privilege.
- Then Install NFS Client on ec2 instance.
apt-get install nfs-common -y
- Create a new folder.
mkdir efs
- Now We can attach or mount efs on a ec2 instance using two method.
- When we select Mount via DNS.
- Copy the commands & Run on ec2 instance using ssh.Instead of /efs provide the path on efs folder.
- When we select Mount via IP.
- Copy & paste the command on ec2 instance using ssh.
Create Elastic File System using Shell
- Setup aws-cli on your system so click on link https://www.hackerxone.com/blog/how-install-configure-aws-cli-ubuntu-1804
- Run the following command:
aws efs create-file-system –performance-mode generalPurpose –throughput-mode bursting –encrypted –tags Key=Name,Value=file-system