S3 Storage#
Module type
S3Storage: A storage module for saving media files to an S3-compatible object storage.
Features#
Uploads media files to an S3 bucket with customizable configurations.
Supports
random_no_duplicatemode to avoid duplicate uploads by checking existing files based on SHA-256 hashes.Automatically generates unique paths for files when duplicates are found.
Configurable endpoint and CDN URL for different S3-compatible providers.
Supports both private and public file storage, with public files being readable online.
Notes#
Requires S3 credentials (API key and secret) and a bucket name to function.
The
random_no_duplicateoption ensures no duplicate uploads by leveraging hash-based folder structures.Uses
boto3for interaction with the S3 API.Depends on the
HashEnrichermodule for hash calculation.
Configuration Options#
YAML#
# steps configuration
steps:
...
storages:
- s3_storage
...
# module configuration
...
s3_storage:
path_generator: flat
filename_generator: static
bucket:
region:
key:
secret:
random_no_duplicate: false
endpoint_url: https://{region}.digitaloceanspaces.com
cdn_url: https://{bucket}.{region}.cdn.digitaloceanspaces.com/{key}
private: false
Command Line:#
Option |
Description |
Default |
Type |
|---|---|---|---|
|
Optional. how to store the file in terms of directory structure: ‘flat’ sets to root; ‘url’ creates a directory based on the provided URL; ‘random’ creates a random directory. |
flat |
string |
|
Optional. how to name stored files: ‘random’ creates a random string; ‘static’ uses a hash, with the settings of the ‘hash_enricher’ module (defaults to SHA256 if not enabled). |
static |
string |
|
Optional. S3 bucket name |
None |
string |
|
Optional. S3 region name |
None |
string |
|
Optional. S3 API key |
None |
string |
|
Optional. S3 API secret |
None |
string |
|
Optional. if set, it will override |
False |
bool |
|
Optional. S3 bucket endpoint, {region} are inserted at runtime |
https://{region}.digitaloceanspaces.com |
string |
|
Optional. S3 CDN url, {bucket}, {region} and {key} are inserted at runtime |
https://{bucket}.{region}.cdn.digitaloceanspaces.com/{key} |
string |
|
Optional. if true S3 files will not be readable online |
False |
bool |