12

I am trying to setup EFS and access it using EC2 instances in different availability zones. I have created a separate security group for EFS, which allows traffic for the security group attached to EC2 instances. Installed amazon-efs-utils utility on the EC2 instances also. But when trying to execute the following command: sudo mount -t efs -o tls EFS-ID:/ efs

I am getting the following error:

mount.nfs4: Connection reset by peer

I have tried it several times, but it did not work. What am I missing here ? Could anyone please let me know.

Thanks

Ashy Ashcsi
  • 1,529
  • 7
  • 22
  • 54

6 Answers6

10

Does the first answer on here help you?

https://forums.aws.amazon.com/thread.jspa?threadID=236697

(which recommends going to the Network Interfaces menu within EC2 and checking that the mount targets for the EFS volume are in the same security group as your EC2 instances).

Cheers, Kingsley.

  • This fixed it for me. – Omar Shabab Oct 04 '20 at 04:29
  • 1
    Helpful link! A bit different for me, I needed an Outbound NFS rule on my EC2 instance's sg (see post by GauravSCloudGuru, Nov 3, 2019 at https://forums.aws.amazon.com/thread.jspa?threadID=236697 ). – jgreve Dec 01 '20 at 08:39
6

Go to your efs security group

In inbound rules add rules and try again

enter image description here

Anton Makarov
  • 101
  • 1
  • 5
6

For me, I needed a combination of other answers (Kingsley and Anton - give them some votes if my answer helps).

First, I made sure the EFS volume and the EC2 instance had a shared security group.

Second, I made sure that specific security group allowed both Inbound and Outbound access on the NFS port, using itself as the "target". To make sure that's clear, if my security group is sg-1234, then I edited the inbound rules for sg-1234 - adding an entry for NFS that targeted sg-1234. The same may be necessary with outbound, but my SG already had outbound access wide open.

I may not have needed the shared security group, but could have used the EC2 security group as the target of an inbound NFS rule in the EFS security group.

thelr
  • 1,134
  • 11
  • 30
2

for me it was to add 0.0.0.0/0 as the the 'Source' for NFS in the security group:

https://acloud.guru/forums/aws-csa-2019/discussion/-M53gZu0xfEjCpLq_uBD/elastic_file_system_lab-_mount

dchutc
  • 29
  • 1
2

This was becase DNS hostnames was not enabled on the custom VPC which I had created. It worked after enabling it. Please find more information here: https://docs.aws.amazon.com/efs/latest/ug/mounting-fs-mount-cmd-dns-name.html

thx

Ashy Ashcsi
  • 1,529
  • 7
  • 22
  • 54
2

This is a security groups issue. Makesure every instance in all AZ are in same Security Group.

Med Sep
  • 346
  • 1
  • 6