How to Mount AWS S3 Bucket on Linux (OEL/Centos/Ubuntu)

I am going to use  S3FS solution which is FUSE (File System in User Space). Using this we can use commands like cp, mv on the system. It will be a normal mount on the Linux system.


 You must create s3 bucket in AWS console. I created a folder funmount.



1: Remove Existing Packages

Login to your Linux instance. 

First of all, check whether you have already installed any existing fuse or S3FS on your server. In case it exists, then remove it to avoid conflicts on the server.

For CentOS OR RHEL Users:

 # yum remove fuse fuse-s3fs

For Ubuntu Users:

 $ sudo apt-get remove fuse


2: Install dependency Packages.

Now you must install packages that are required for fuse and s3cmd.

For CentOS or RHEL users:

#  yum install openssl-devel gcc libstdc++-devel gcc-c++ fuse fuse-devel curl-devel libxml2-devel mailcap git automake

For Ubuntu Users:

# apt-get install build-essential libcurl4-openssl-dev libxml2-dev mime-support


3: Download and Compile Latest Fuse.

Change your directory location to /usr/src using cd command then download and compile fuse source code. After compiling, add fuse to the kernel. In our example we are using fuse version 3.0.1.

#cd /usr/src/


#tar xzf fuse-3.0.1.tar.gz

#cd fuse-3.0.1

#./configure --prefix=/usr/local

#make && make install

#export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig


#modprobe fuse


4: Download and Compile Latest S3FS

To download the latest version of s3FS change your directory to “/usr/src/” along with below list of commands.

#cd /usr/src/


#tar xzf  v1.82.tar.gz

#cd s3fs-fuse-1.82


#./configure --prefix=/usr --with-openssl


#make install


5:Setup Access Key

To configure s3fs you need both access key and secret key of your s3 AWS account  I am using root account to do the setup.

NOTE: Kindly replace the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY with your actual key values.



# chmod 600 ~/.passwd-s3fs


6:Mount S3 Bucket on Linux

The final step would be to mount the s3 bucket on Linux flavors such as CentOS, RHEL and Ubuntu.

For this example, we are using s3 bucket name as “funmount“ and mount point as /s3mnt_pt.

# mkdir /tmp/cache

# mkdir /s3mount

# chmod 777 /tmp/cache /s3mount

# s3fs -o use_cache=/tmp/cache funmount /s3mount

Add below entry in fstab to automatically mount after reboot.

s3fs#funmount /s3mount fuse _netdev,rw,nosuid,nodev,allow_other,nonempty,use_cache=/tmp/cache 0 0 

How to access your s3 bucket just use normal cd , ls command.

# cd /s3mount

# ll

total 1

d---------. 1 root root 0 Jan 12 10:37 myfolder

# cd myfolder

# ll

total 1

----------. 1 root root root an 12 10:39 bucket.rtf

# pwd


If you like please follow and comment