2

What is best practice to keeps dynamic or user submitted files between deployments? i.e. git aws.push simply removes existent app directory and then extract new version onto EC2 instance, but I need to keep some logs, settings and user submitted data stored on filesystem.

I'm about to mount S3 bucket, but I can't find any post-deployment hooks on AWS Beanstalk to trigger mount S3 automagically...

wik
  • 156
  • 4

1 Answers1

1

I would rethink why your application is storing things to the local system to begin with. Having those files removed on deploys is only one problem. Another problem is that when your app scales to more than one instance, those instances will not know about any of the files on the other instances. It would be best to have your app use S3 for all of your storage, or use some other mechanism that is permanent and accessible from any instance that is running your app.

Another thing to think about is user sessions. If you were previously storing sessions on the server, then you need to do something different there as well. Once there is more than one instance of your app running, session data will be unreliable unless you store it somewhere accessible by all of the instances. Elasticache or DynamoDB might be good options for session storage.

jeremeamia
  • 111
  • 2