How to access EFS folders from the Windows File Explorer using WSL2

EFS is the default place for storing your volumes when you use Fargate and ECS in AWS. This is fine when your main workstation is any Linux distro, but what happens when you work in Windows?

The easy option is to use Windows Subsystem for Linux (Ubuntu, in my case) and mount your EFS:

sudo mount -t nfs4 -o rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport MY_IP_ADDRESS:/ efs
  • MY_IP_ADDRESS is your AWS-provided IP.
This is fine if you just want to access your files or folders from your console, but you don't need to do anything more complex with them. However, if you want to map it as a "regular" Network Drive and/or access it from the Windows File Explorer can be tricky. This is how I accomplished it:

Step 1. Create your efs folder (mkdir efs) in this location /mnt/wsl.
Step 2. Mount your efs using the previous command.
Step 3. Go to this location \\wsl$ in the File Explorer, and get your Distro's root path. In my case, \\wsl$\Ubuntu

Step 4. Copy your Distro's path and map it as your new Network Drive in Windows:

And that's all. Now you can access your EFS from your Network Drive, for example, Z:\mnt\wsl\efs

  • Remember, you must keep the Ubuntu console open to access the Network Drive.
  • If you restart/shut down your computer or close your session, you must follow steps 1 and 2 again.