Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connection reset by peer : AWS EFS

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

like image 915
Ashy Ashcsi Avatar asked Aug 03 '20 14:08

Ashy Ashcsi


People also ask

Why is my EFS file system not working in AWS?

This result is because network file systems need to be initialized after the compute instance starts its networking. If this issue occurs, contact AWS Support. For instances that use the systemd init system with two or more Amazon EFS entries at /etc/fstab, there might be times where some or all of these entries are not mounted.

How do I reset the connection to Mount EFS?

mount.nfs4: Connection reset by peer. We are using the recommended mount command: mount -t efs -o tls [EFS file system ID]:/ /mnt. This happens in ~0.2% of all mount attempts from all our VPCs. It's a particularly nasty issue because it seems to prevent the mount process from being killed cleanly.

How do I use Amazon EFS with AWS codebuild?

Create a CodeBuild project to use with Amazon EFS Create a AWS CodeBuild project that uses the VPC you created earlier in this sample. When the build is run, it mounts the Amazon EFS file system created earlier.

How to Mount EFS on Amazon EC2 instance?

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


4 Answers

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.

like image 113
thelr Avatar answered Sep 20 '22 06:09

thelr


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.

like image 36
Kingsley Tart Avatar answered Sep 22 '22 06:09

Kingsley Tart


Go to your efs security group

In inbound rules add rules and try again

enter image description here

like image 25
Anton Makarov Avatar answered Sep 21 '22 06:09

Anton Makarov


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

like image 40
dchutc Avatar answered Sep 21 '22 06:09

dchutc