Configure Scaleway S3 for Active Storage in Rails 6.0

2 min readMar 26, 2021


Scaleway is a French web hosting company, founded by Xavier Niel in 1999. It provides physical and online dedicated servers, domain registration services and datacenters.

In 2020, Scaleway was the second player in France behind OVHCloud and the third in Europe.

If you want an alternative to Amazon AWS S3 storage services, follow along this tiny and easy tutorial 😊

Scaleway part

Let’s begin with the Scaleway config 👨🏻‍🔧

1️⃣ First step: Create an account on Scaleway Elements:

2️⃣ Second step: Create your S3 bucket by going to your Scaleway console and “Object Storage” tab.

Here, a help procedure if needed:

3️⃣ Third step: Generate your Access key and your Secret key 🔐 (do not forget to store them somewhere like 1Password or Bitwarden for example):

Ruby On Rails part

The funniest part: integrating Scaleway into your Rails app 👩🏽‍💻

  • After installing ActiveStorage and creating the active_storage_tables migration, you can add the “aws-sdk-s3” gem to your Gemfile
# Gemfile
gem 'aws-sdk-s3', require: false
  • Then, you can add your credentials to your .env file (do not forget to add your file to your .gitignore)
# .env
  • Add this config to you storage.yml with your personal keys and bucket
# storage.yml
service: Disk
root: <%= Rails.root.join("tmp/storage") %>
service: Disk
root: <%= Rails.root.join("storage") %>
service: S3
# Scaleway API endpoint, depending on your region
# Do not forget to hide your secrets
access_key_id: <%= ENV['SCALEWAY_ACCESS_KEY_ID'] %>
# Do not forget to hide your secrets
secret_access_key: <%= ENV['SCALEWAY_SECRET_ACCESS_KEY_ID'] %>
region: fr-par # Your bucket region, here it's Paris
bucket: <%= ENV['SCALEWAY_BUCKET_NAME'] %> # Your bucket name
  • Do not forget to tell Rails to use Scaleway storage in production environment
# production.rb
config.active_storage.service = :scaleway
  • Finally, you can attach your files to your records as usual 🙌🏻
# user.rb
has_one_attached :avatar
# users_controller.rb

That’s it 🎉

François Loupias • Développeur web fullstack @Kinoba

👉 Check out the article on :




Teepee made web apps — L’agence web qui développe ta plateforme sur mesure