Create two EC2 instances in different AZs (you can use public subnets). Create an NFS file system using EFS and mount it using one of the EC2 instances. Create some files for testing purposes. Then try to mount and access the file system from the other EC2 instance. Note that the access should work simultaneously.
Make sure your VPC is configured to enable mounting using DNS names. You can do that by going to your VPC's action menu and selecting Edit DNS Resolution and Edit DNS Hostnames. Make sure both are set to Yes.
Create a security group named nfs-access to allow access to the NFS file system to members of the security group.
First Create the security group.
Then edit its inbound rule to allow access from members of the group.
Launch two EC2 instances, each on its own AZ. Use the user-data.sh to install Amazon's EFS utility package. Make sure your instances are members of the nfs-access security group and are also accessed via ssh.
Go to Storage - EFS and click Create file sytem.
Copy the EFS file system ID.
Access one of the EC2 instances using ssh. Create a folder to be the mounting point (let's say data). Then using your EFS file system ID (mine was fs-9ee0b987) issue the command:
sudo mount -t efs fs-9ee0b987:/ data
You should be able to access the file system. Create a few testing files.
No comments:
Post a Comment