Like most Platform as a Service providers, Elastic Beanstalk does not provide a persistent filesystem:
Persistent Storage
AWS Elastic Beanstalk applications run on Amazon EC2 instances that have no persistent local storage. When the Amazon EC2 instances terminate, the local file system is not saved, and new Amazon EC2 instances start with a default file system. You should design your application to store data in a persistent data source. Amazon Web Services offers a number of persistent storage options that you can leverage for your application, including
- Amazon Simple Storage Service (Amazon S3). For more information about Amazon S3, go to the documentation.
- Amazon Elastic Block Store (Amazon EBS). For more information, go to the documentation and see also the article Feature Guide: Elastic Block Store.
- Amazon DynamoDB. For more information, go to the documentation. For an example using Amazon DynamoDB with AWS Elastic Beanstalk, see Example: DynamoDB, CloudWatch, and SNS.
- Amazon Relational Database Service (Amazon RDS). For more information, go to the documentation and see also Amazon RDS for C# Developers.
This means that you cannot store files dynamically and expect them to survive a new deployment.
The recommended solution is to use a cloud file storage provider like S3.