Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

chinhle's avatar

Laravel deploy with EB CLI public/storage wipe out

I'm deploying my Laravel application to AWS by EB CLI. Problem with it is, it will zip everything and create a new version on the instance, removing everything user may have uploaded into public/storage folder. Usually how do we avoid this ?

0 likes
3 replies
MarkLL's avatar
MarkLL
Best Answer
Level 7

Two choices IMHO.

  1. Back it up! create a job that backs up the folder to an S3 bucket.
  2. Change you app to store it in an S3 bucket... this is the correct answer i feel :).

If the EC2 instance crashes and it recovers, you will loose you files again... Where is the db stored?

chinhle's avatar

the db is stored in a separate instance so it's fine. I think using S3 is the way here. But out of curiousity, if not S3 and backup job, what's the practice in going about this ?

MarkLL's avatar

Its the same as the DB in that it needs to be in a separate container and S3 is the best medium for the storage of files.

Hopefully the DB is stored in an RDS instance and not an EC2 instance!

Again this is just my opinion - with a bit of experience thrown in...

Please or to participate in this conversation.