Mount an S3 bucket as local folder

I am based on this previous idea from Anthony Heddings.

First of all install s3fs package in your Ubuntu:

sudo apt install s3fs

After that you have to go to your AWS console to create a bucket and a user with read/write access permissions to S3. For that purpose this video from Tech Arkit is really useful.

This user should give you a key and secret to access your buckets, that you have to config in you system:

touch /etc/passwd-s3fs
echo ACCESS_KEY_ID:SECRET_ACCESS_KEY > /etc/passwd-s3fs
chmod 600 /etc/passwd-s3fs

Then you can mount your bucket:

mkdir /mnt/bucket-name
s3fs bucket-name /mnt/bucket-name

Usually it takes hours to Amazon to propagate the changes, so immediatelly you can experiment problems. Meanwhile you can use this debug command:

s3fs bucket-name /mnt/bucket-name -o dbglevel=info -f -o curldbg

If you want this to mount at boot, you’ll need to add the following to your /etc/fstab:

s3fs#bucket-name /mnt/bucket-name fuse _netdev,allow_other,umask=227,uid=33,gid=33,use_cache=/root/cache 0 0

Leave a Reply

Your email address will not be published. Required fields are marked *