amazon-web-servicesamazon-ec2

EC2 file persistence & Storage


Why is source code stored in EC2 instances when using Beanstalk? Won't these files potentially be deleted?

Edit: Source code is stored in S3 bucket, and copied to EC2s where they are executed.


Solution

  • Seems that, when the app is first deployed, all files are uploaded to an S3 bucket, from where these are copied into the relevant directory of each new instance. In the event new instances have to be created (such as for auto-scaling) or replaced, these instances also pull the code from the S3 bucket. This is also how the app is re-deployed - the bucket is updated and each instance makes a new copy of the code.

    Apologies if this is stating the obvious to some people, but I had seen a few similar queries.