Thursday, April 25, 2024
Google search engine
HomeDevOpsInstall s3fs on AWS S3

Install s3fs on AWS S3

s3fs allows Linux and macOS to mount an S3 bucket via FUSE. s3fs preserves the native object format for files, allowing use of other tools like AWS CLI.

Installation

Many systems provide pre-built packages:

Amazon Linux via EPEL:

    sudo amazon-linux-extras install epel
    sudo yum install s3fs-fuse

Arch Linux:

    sudo pacman -S s3fs-fuse

Debian 9 and Ubuntu 16.04 or newer:

    sudo apt install s3fs

Fedora 27 or newer:

    sudo dnf install s3fs-fuse

Gentoo:

    sudo emerge net-fs/s3fs

RHEL and CentOS 7 or newer via EPEL:

    sudo yum install epel-release
    sudo yum install s3fs-fuse

SUSE 12 and openSUSE 42.1 or newer:

    sudo zypper install s3fs

macOS via Homebrew:

    brew install --cask osxfuse
    brew install s3fs

Examples

s3fs supports the standard AWS credentials file stored in ${HOME}/.aws/credentials. Alternatively, s3fs supports a custom passwd file.

The default location for the s3fs password file can be created:

  • using a .passwd-s3fs file in the users home directory (i.e. ${HOME}/.passwd-s3fs)
  • using the system-wide /etc/passwd-s3fs file

Enter your credentials in a file ${HOME}/.passwd-s3fs and set owner-only permissions:

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

Run s3fs with an existing bucket mybucket and directory /path/to/mountpoint:

s3fs mybucket /path/to/mountpoint -o passwd_file=${HOME}/.passwd-s3fs

If you encounter any errors, enable debug output:

s3fs mybucket /path/to/mountpoint -o passwd_file=${HOME}/.passwd-s3fs -o dbglevel=info -f -o curldbg

You can also mount on boot by entering the following line to /etc/fstab:

mybucket /path/to/mountpoint fuse.s3fs _netdev,allow_other 0 0

If you use s3fs with a non-Amazon S3 implementation, specify the URL and path-style requests:

s3fs mybucket /path/to/mountpoint -o passwd_file=${HOME}/.passwd-s3fs -o url=https://url.to.s3/ -o use_path_request_style

my example fstab configuration (tested)

mybucket /mnt/point fuse.s3fs _netdev,allow_other,use_path_request_style,url=https://s3.ap-xxx.amazonaws.com 0 0

If you have any questions or feedback, feel free to leave a comment.

YOU CAN SUPPORT DEVNINJA WITH A CUP OF COFFEE

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online. to search or browse the published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or more ) as a token of appreciation.

Support Us

DevNinja
DevNinja
System & Network Administrator Ninja
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

7 + 10 =

- Advertisment -
Google search engine

Most Popular

Recent Comments