Add extra s3 bucket storage on Ubuntu

To add some s3 bucket storage on Ubuntu it’s easy

Get your credentials from s3 provider

Scaleway : https://fab.ovh/get-s3-credentials-scaleway/

OVH : https://fab.ovh/get-s3-credentials-ovh-public-cloud/

Mount your bucket in the system (manually)

You must first install s3fs (starting Ubuntu 18.04 it’s a package, before you must install with some command)

apt -y install s3fs

There are no limit to mount buckets.

I recommand you to store your credentials safely

mkdir -p /etc/s3fs/
echo ACCESS_KEY:SECRET_KEY > /etc/s3fs/scw-bucket1
chmod 600 /etc/s3fs/scw-bucket1
echo ACCESS_KEY:SECRET_KEY > /etc/s3fs/ovh-bucket2
chmod 600 /etc/s3fs/ovh-bucket2

You can mount you bucket manually with

s3fs my-bucket-name /mnt/some-path -o passwd_file=/etc/s3fs/scw-bucket1 -o url=https://s3.fr-par.scw.cloud
s3fs my-bucket-name /mnt/some-path -o passwd_file=/etc/s3fs/ovh-bucket2 -o url=https://storage.sbg.cloud.ovh.net

You can add the -f option at the end to display some debug informations. If the mount goes wrong, the command ends, if the mount is conform, the command is waiting (and a CTRL+C unmount the bucket)

Mount the bucket with /etc/fstab

Open /etc/fstab with your favorite editor

nano /etc/fstab

Add at the end of the file

s3fs#my-bucket-name /mnt/some-path fuse _netdev,allow_other,use_path_request_style,umask=0222,uid=0,gid=0,passwd_file=/etc/s3fs/scw-bucket1,url=https://s3.fr-par.scw.cloud/ 0 0
s3fs#my-bucket-name /mnt/some-path fuse _netdev,allow_other,use_path_request_style,umask=0222,uid=0,gid=0,passwd_file=/etc/s3fs/ovh-bucket2,url=https://storage.sbg.cloud.ovh.net/ 0 0