DEV Community

Cover image for S3 Alternatives for Rails' ActiveStorage
Rails Designer
Rails Designer

Posted on • Originally published at railsdesigner.com

S3 Alternatives for Rails' ActiveStorage

This article was originally published on Rails Designer


It's beautifully simple and easy to set up. Adding an user avatar is just one line of code:



class User < ApplicationRecord
  has_one_attached :avatar
end


Enter fullscreen mode Exit fullscreen mode

Love Rails! ❤️

Being one of the first to market, Amazon's S3 (Simple Storage Service), has been the default storage provider for your ActiveStorage attachments. But the last few years more options have appeared. This is great for companies and customers alike!

For my next big thing, I have explored other options to store files my customers upload. One requirement I had was that they had to be S3-compatible. Meaning using the same API and functionality as S3, allowing applications designed for S3 to work with it without modification.

The alternatives

These are the contenders I explored and sharing with you. Most are cheaper than S3, but that was not the goal for my research.

My shortlist includes:

  • DigitaOcean Spaces
  • Wasabi
  • Cloudflare R2
  • Backblaze B2
  • Hetzner S3

I've just listed the basic details. Pricing per provider is often quite different. Some charge GB per hour of storage. Some have tiered pricing per amount of TB. Others charge in blocks of 250GB. Some charge for egress, some not. Argh! 😱 All to say: don't use just the prices below to make a decision!

DigitalOcean Spaces

DigitalOcean Spaces launched in 2017. They start at $5 per month, including 250GB of storage and 1TB of outbound transfer. $0.02/GiB additional storage and $0.01/GiB additional transfer.

Wasabi

Wasabi launched in 2017. Pricing starts at $6.99 per TB. It will be $.0068 for every next GB per month. Egress data is on a fair-use policy (monthly egress data transfer is less than or equal to your active storage volume).

Cloudflare R2

Cloudflare R2 launced in 2021. They have minimum pricing of $0.015 per GB/month for storage, but no egress fees.

Backblaze B2

Backblaze launched its B2 service in 2015. Costs are $6 per TB per month with egress fees being free for up to 3× your average monthly storage amount (overage is priced at $0.01/GB).

Hetzner S3

Hetzner's S3 service is currently (October 2024) in beta. Price of will be €5.95 per TB per month.

The beauty of ActiveStorage is it comes with a Mirror service that is intended to be used temporarily during a migration between services in production.

Do you have any (real life) experience with any of these? Let me know below.

Top comments (0)