Elastic Beanstalk - EFS Failing to Mount on deployment - Device or resource busy Elastic Beanstalk - EFS Failing to Mount on deployment - Device or resource busy docker docker

Elastic Beanstalk - EFS Failing to Mount on deployment - Device or resource busy


I had this same issue for a while and finally found the answer in this article from AWS Knowledge Center:

Important: You can't mount an Amazon EFS volume directly to the application directory because the contents of /var/app/current are moved to /var/app/current.old whenever you deploy an Elastic Beanstalk application.

The solution is to mount EFS to some other directory and create a symlink between that and your /current directory, or whatever other sub directory you are mounting to in /var/app/current.

I did this by modifying my storage-efs-mountfilesystem.config (in .ebextensions - example efs-mountfilesystem.config) to mount to /efs instead of /var/app/current/wwwroot/user_content, and added a new storage-efs-symlink.config (name it whatever you like) config file in .ebextensions that runs this command:

container_commands:  01_symlink:    command: ln -s /efs ./wwwroot/user_content