Store Django Media on Wasabi Hot Cloud Storage
Use Wasabi S3-compatible storage for Django media and backups with django-storages: set the regional endpoint, create a restricted policy, serve files with presigned URLs or a CDN, and understand minimum storage duration and egress terms.
Problem statement
Your Django app stores a lot of media, video, or backups, and AWS S3 storage and egress costs are growing. Wasabi offers S3-compatible storage at a flat per-terabyte price without separate egress or API request fees under its fair-use terms. django-storages works with it, but Wasabi has its own regional endpoints, a minimum storage duration, and egress guidelines that matter for how you serve files.
- Create a bucket in a Wasabi region near your servers and a sub-user with a policy limited to that bucket.
- Configure django-storages with
endpoint_url = "https://s3.<region>.wasabisys.com"andregion_name = "<region>". - Serve private media with presigned URLs; for heavy public traffic, put a CDN in front.
- Remember Wasabi's minimum storage duration: deleting objects soon after upload is still billed for the minimum period.
- Check the egress policy: downloads well beyond your stored volume may not fit the free-egress terms.
Step-by-step solution
1. Create the bucket and a restricted user
In the Wasabi console, create the bucket in a region such as eu-central-1 or us-east-1. Create a user for the app with an access key and attach a policy scoped to the bucket:
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": ["s3:GetObject", "s3:PutObject", "s3:DeleteObject", "s3:ListBucket"],
"Resource": ["arn:aws:s3:::shop-media", "arn:aws:s3:::shop-media/*"]
}]
}
Never give the Django app your root account keys.
2. Configure django-storages
STORAGES = {
"default": {
"BACKEND": "storages.backends.s3.S3Storage",
"OPTIONS": {
"bucket_name": "shop-media",
"endpoint_url": "https://s3.eu-central-1.wasabisys.com",
"region_name": "eu-central-1",
"access_key": os.environ["WASABI_ACCESS_KEY"],
"secret_key": os.environ["WASABI_SECRET_KEY"],
"signature_version": "s3v4",
"default_acl": None,
"querystring_auth": True,
"querystring_expire": 3600,
"file_overwrite": False,
},
},
"staticfiles": {"BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage"},
}
Using the wrong regional endpoint for the bucket produces redirects or signature errors. Wasabi's region names look like AWS's, but the endpoints are Wasabi's own.
3. Serve files
Presigned URLs are fine for user-specific files. For public, high-traffic assets such as product images, place a CDN (Cloudflare, Bunny, or another) in front of a public bucket or prefix. A CDN reduces latency for users far from the region and keeps egress within Wasabi's guidelines.
4. Avoid short-lived objects
Because objects are billed for a minimum duration even if deleted earlier, do not use Wasabi for temporary uploads, transient exports, or caches that churn daily. Keep those on local disk, in a different bucket elsewhere, or in a service without minimum duration. Wasabi fits durable media, archives, and backups.
5. Use it for backups too
Wasabi is popular as an off-site target for database dumps and media backups. Tools such as django-dbbackup, rclone, restic, and pgBackRest work with its S3 endpoint. Enable object lock or versioning on the backup bucket to protect against accidental or malicious deletion.
Explanation
Wasabi implements the S3 API, so django-storages and boto3 work after pointing them at a Wasabi endpoint and region. Its business model replaces per-request and egress charges with a flat storage price plus usage guidelines, which makes costs predictable for large archives and media libraries. Those guidelines, minimum storage duration and egress relative to storage, determine which Django file types belong there.
Edge cases / notes
- Feature parity. Most S3 features used by Django work; check Wasabi's documentation for specifics such as lifecycle rules or event notifications.
- CORS. Direct browser uploads need a CORS configuration on the bucket.
- Latency. Choose the region closest to your servers; cross-continent requests add noticeable delay to uploads.
Next steps
- Review S3 patterns in Store Django Media Files on S3.
- Another low-cost option: Store Django Media on Backblaze B2.
- Protect media with Back Up Django Media Files.
FAQ
Does django-storages support Wasabi?
Yes, through the S3 backend with Wasabi's endpoint and region.
Is egress free on Wasabi?
Under its fair-use terms, there are no separate egress fees, but very high egress relative to storage may not fit. Use a CDN for heavy public traffic.
Why is Wasabi bad for temporary files?
Objects are billed for a minimum storage duration even if deleted earlier.
Can I use Wasabi for database backups?
Yes. It works as an S3 target for backup tools; enable object lock for protection.