I am following the AWS tutorial that tells us how to mount EFS system to elastic beanstalk instances available at https://aws.amazon.com/premiumsupport/knowledge-center/elastic-beanstalk-mount-efs-volumes/.
I am mounting this folder inside the current
folder, as it needs to be accessible by my web application as a path, e.g: public/medias
. So I am mounting EFS inside my app public folder and all media will be accessible through the webserver.
The first mount is ok, but after the first deployment, it seems that elastic beanstalk is trying to remove the folder when clearing up the app/current
folder for a new deployment, then the deploy fails to remove the mounted unit which is inside current with a message that can not remove directory - Device or resource busy
.
It's not possible to mount EFS directories inside current
folder for elastic beanstalk? Or I should consider in mounting it outside of the application folder then I could use something like symlink for accessing the files through a web server?
The reason why I am mounting this inside var/app/current/public/media
is because it needs to be accessible through https://mywebsite.com/media/myImage.png
=> this should come from EFS.
I could consider using S3 Buckets
instead but all my web application is reading files using a static path and it would be a massive work to migrate that to read from a bucket.