How do I access my EFS file system across accounts?
Last updated: 2019-05-31
How do I access my Amazon Elastic File System (Amazon EFS) file system across accounts so that I can share files?
You can share your EFS file system across accounts by setting up an Amazon Virtual Private Cloud (Amazon VPC) peering connection between the accounts. After the peering connection is set up, you can mount the file system from instances in both VPCs to access the files. It’s also possible to share your EFS file system across accounts using Shared VPCs or using Transit Gateways. For more information, see Mounting EFS File Systems from Another Account or VPC.
Note: When using inter-region VPC peering, per-operation latency might be higher and throughput will be reduced due to the increased network latency.
In this example, an EFS file system is shared across two AWS accounts—one is an acceptor account with access to the file system, and the other is a requester account that needs access to the file system.
1. Create a VPC peering connection with a VPC in the acceptor AWS account.
2. Be sure that each account has a route table entry for the other account's VPC CIDR block. For more information, see Route Tables for a VPC Peering Connection.
3. From the requester account, accept the VPC peering connection.
4. Create an EC2 instance, if you have not already done so. Then, install a Network File System (NFS) client.
5. Mount the EFS file system from the requester account.
In the following example, replace the mount-target-IP and efs-mount-point with your values:
sudo mount -t nfs -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport mount-target-IP:/ ~/efs-mount-point
Note: DNS resolution is not supported. Use one of the mount target IP addresses that your EC2 instance can access over the VPC peering connection. If your EC2 instance and your EFS file system are in the same AWS Region, use the mount target IP address in your Availability Zone.
6. After the EFS file system is mounted, you can access the file system in the acceptor's account from your EC2 instance.
Note: Sharing large files, or large numbers of small files using single-threaded applications, impacts performance. Amazon EFS supports highly parallelized workloads. For more information, see How can I copy data to and from Amazon EFS in parallel to maximize performance on my EC2 instance?