Use Hetzner Object Storage in Rails Active Storage
Rails
hetzner
ActiveStorage
Hetzner Object Storage is a cheeper AWS S3 alternative (1TB == $6/pm). Here are notes of my experimentation with it:
Summary: It definitely works for Ruby on Rails ActiveStorage 👍 but without direct upload feature.
Summary: It definitely works for Ruby on Rails ActiveStorage 👍 but without direct upload feature.
Rails app config
tested on Rails 8.0
# Gemfile # ... gem "aws-sdk-s3", require: false # used for Hetzner oject storage # ...
# config/storage.yml hetzner_object_storage: service: S3 endpoint: "https://fsn1.your-objectstorage.com" access_key_id: <%= Rails.application.credentials.dig(:hetzner_object_storage, :access_key_id) %> secret_access_key: <%= Rails.application.credentials.dig(:hetzner_object_storage, :secret_access_key) %> region: fsn1 bucket: name_of_my_bucket
hetzner_object_storage: access_key_id: xxxxxxxxxxxxxxxxxxxx secret_access_key: yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
conf
# config/production.rb #... config.active_storage.service = :hetzner_object_storage #...
Direct upload - Configure CORS
TL;DR will not work
"Use of presigned URLs to upload files with CORS requirements" is not supported
Source: https://docs.hetzner.com/storage/object-storage/supported-actions (2025-03-14)

Rails Active Storage direct upload uses presigned PUT url to do Direct upload. So out of luck.
Note: You may Find CORS related article like https://docs.hetzner.com/storage/object-storage/howto-protect-objects/cors/ or https://www.launchway.dev/blog/hetzner-presigned-urls but they are describing different usecase for CORS, not presigned upload related (not direct upload related)
Configure s3cmd - optional
CLI tool to check stuff from console (optional)
Note AWS CLI also works but has some issue with "non AWS" endpoints. It's really buggy
s3cmd --configure
Access Key: | <your_access_key> Secret Key: | <your_secret_key> Default Region: | US S3 Endpoint: | fsn1.your-objectstorage.com DNS-style template for accessing a Bucket: %(bucket)s.fsn1.your-objectstorage.com
s3cmd ls s3cmd ls s3://name_of_my_bucket s3cmd info s3://name_of_my_bucket