Home > other >  Should I store static files in a separated S3 when deploying with AWS Elastic Beanstalk?
Should I store static files in a separated S3 when deploying with AWS Elastic Beanstalk?

Time:09-23

I've got a Django app running on AWS Elastic Beanstalk. Beanstalk created an S3 bucket to store the source code, versions, etc.

I've configured the S3 bucket to store also my static files. Every time I deploy a new version of the code, eb runs the collectstatic command correctly and creates the static files, but it overrides the permissions. So for every new deploy, I need to go, select the static folder and make the objects public manually.

Question: Is it correct to store my static files in the same bucket, or should I create a separate one with a public policy?

Question 2: If it's better to use the same bucket, how can I define a public policy for the static folder, but not the other folders such as the source code?

CodePudding user response:

It's better to use a separate bucket so you can lock down the bucket containing private files. You will probably want to enable static website hosting for the bucket with static files, and that's not something you want to enable on a bucket that also contains private files.

There's 0 additional cost, so there is no reason not to split them up.

  • Related