AWS Beanstalk autoscale user files

36 views Asked by At

I have setup AWS Beanstalk instance where a server app is deployed. In the backend users can change files in images/ directory. But when autoscaling the instances, the user files are not mirrored. How to solve this requirement? Can I setup AWS Ec2 to create new AMI each night based on last EC2 files and use that for autoscaling. Or is there better approach?

1

There are 1 answers

1
Max On BEST ANSWER

There are a few options, but in general first you need to understand that in order to scale horizontally (add more servers), your servers have to be "stateless" meaning they can't have any special information on them, including but not limited to user uploaded files.

The current "best practice" (and cheapest, most reliable, most robust, etc.) option is instead of having user upload files sit on the filesystem, save them on S3. Then when you need to load them, read them from S3.

Another option, still in Preview Mode, is to use the new Elastic File System service to provide you with a scalable, reliable, shared hard drive. All of your servers can connect to your EFS drive, and they all have access to the same files. You can scale up and down without losing your files.