Reputation: 1597
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
Upvotes: 12
Views: 15644
Reputation: 1194
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.
Upvotes: 6
Reputation: 344
This is a security groups issue. Makesure every instance in all AZ are in same Security Group.
Upvotes: 2
Reputation: 1597
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
Upvotes: 2
Reputation: 29
for me it was to add 0.0.0.0/0 as the the 'Source' for NFS in the security group:
Upvotes: 2
Reputation: 111
Go to your efs security group
In inbound rules add rules and try again
Upvotes: 6
Reputation: 109
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.
Upvotes: 10