How to manually upload static content with elastic beanstalk and s3 How to manually upload static content with elastic beanstalk and s3 flask flask

How to manually upload static content with elastic beanstalk and s3


You're correct, this type of static content should not be part of your repository and certainly not stored on EC2 instance's volumes.

AWS' best practice for this use case would be to use S3 and directly link to S3 objects from your HTML code. S3 is a natively HTTP enabled object storage service.

In order to use S3 as web server, you must create a bucket on S3.

You can either use the S3 provided URL <bucket-name>.s3-website-<AWS-region>.amazonaws.com to link to your content from your web pages.

Or you can use your own domain name. In this case, your bucket name must be named after your domain name and you must enable "Website Hosting" option at the bucket level. This is required to let S3 know how to map HTTP requests to buckets.

A high level scenario is described here : http://docs.aws.amazon.com/gettingstarted/latest/swh/website-hosting-intro.htmlAnd more details are provided by S3 documentation.

As an added benefit, storage in S3 costs less money than EBS storage.