Storing Files on Amazon S3¶
If you’re using containers for deployment (including Docker and Heroku) you’ll want to avoid storing files in the container’s volatile filesystem. This integration allows you to delegate storing such files to Amazon’s S3 service.
- Your AWS access key.
- Your AWS secret access key.
Serving media files with a S3 bucket¶
If you want to store and serve media files, set the following environment variable to use S3 as media bucket:
- The S3 bucket name to use for media files.
If you are intending into using a custom domain for your media S3 bucket, you can set this environment variable to your custom S3 media domain:
- The S3 custom domain to use for the media bucket.
The media files are every data uploaded through the dashboard (product images, category images, etc.)
Serving static files with a S3 bucket¶
By default static files (such as CSS and JS files required to display your pages) will be served by the application server.
If you intend to use S3 for your static files as well, set an additional environment variable:
- The S3 bucket name to use for static files.
If you are intending into using a custom domain for your static S3 bucket, you can set this environment variable to your custom S3 domain:
- The S3 custom domain to use for the static bucket.
<?xml version="1.0" encoding="UTF-8"?> <CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <CORSRule> <AllowedOrigin>*</AllowedOrigin> <AllowedMethod>GET</AllowedMethod> <AllowedMethod>HEAD</AllowedMethod> <MaxAgeSeconds>3000</MaxAgeSeconds> <AllowedHeader>*</AllowedHeader> </CORSRule> </CORSConfiguration>