How to prevent specific folders from being replaced in every deployment? Consider the directory structure below:
-- /.ebextensions
-- /app
-- /database
-- /public
---- /css
---- /js
---- /images
I'm using AWS CodeCommit and EB CLI for my PHP application and every time I run eb deploy
these files & directories are being replaced, so I want to exclude the /public/images
directory so that the previous images that have been uploaded would still be there after a newer version has been deployed.
I've been digging on their documentation all week, but can't find any possible solution.Is this something possible with Elastic Beanstalk? Or any alternative suggestions for deployment in AWS will be very much appreciated. Thanks in advance!
Create a .ebignore
file and list all files and directories there. If there is not .ebignore
file it will use the .gitignore
to exclude files from deployment.
I still do not think it will resolve the issue since the images folder will still be deleted. I would suggest that you use S3 bucket and upload/get all images from there so you wont't have issues on deployment.
Please note that if you upload an image, when there are 3 ec2 at that time of image upload, the image will only be uploaded on one server unless you sync the ec2 on every upload. And this will result in certain users getting a 404 image not found while others will be able to see it.
You can also have a look at EBS volumes in order to try to achieve persistent storage with elastic beanstalk: https://aws.amazon.com/ebs/