Version: 2.10

Storing Files on Amazon S3

If you use containers for deployment (including Docker and Heroku), you should not store files within the container’s filesystem.

This integration allows you to delegate storing such files to Amazon’s S3 service.

Environment variables

Variable NameDescription
AWS_ACCESS_KEY_IDYour AWS access key.
AWS_SECRET_ACCESS_KEYYour AWS secret access key.
AWS_MEDIA_BUCKET_NAMEThe S3 bucket name to use for media files.
AWS_MEDIA_CUSTOM_DOMAINThe custom domain to use for the media bucket.
AWS_STORAGE_BUCKET_NAMEThe S3 bucket name to use for static files.
AWS_STATIC_CUSTOM_DOMAINThe custom domain to use for the static bucket.

Serving media files from an S3 bucket

"Media files" are the files uploaded through the dashboard. They include product images, category images, and non-image files.

If you want to use S3 to store and serve media files, you need to configure at least the bucket name (see table above).

Custom domain will allow you to use your CloudFront distribution or the public domain of your S3 bucket's static hosting.

Serving static files from an S3 bucket

"Static files" are assets required for Saleor to operate. They include assets used in default email templates.

If you also wish to use S3 for your static files, you need to configure at least the bucket name (see table above).

Custom domain will allow you to use your CloudFront distribution or the public domain of your S3 bucket's static hosting.

Cross-Origin Resource Sharing

You need to configure your S3 bucket to allow cross-origin requests for some files to be properly served (SVG files, Javascript files, etc.). Follow the below instructions in your S3 Bucket’s permissions tab, under the CORS section.

<?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>