Mount S3 Bucket on Linux/Centos EC2 Instance using s3fs

S3FS is File System in User Space(FUSE) based to mount an Amazon S3 buckets, We can use system commands with drive (like as another Hard Disk) your  server. On s3fs mounted files systems you can simply use  the basic Unix commands similar to run on locally attached disks. Mount S3 Bucket on Linux/Centos EC2 Instance using s3fs

In this article we are showing how to mount s3bucket in linux EC2 instance.
First check if you have already s3fs or fuse package installed in your machine. If installed it already remove it by below command.

# yum remove fuse fuse-s3fs

Installation of fuse and s3fs packages

After removing the fuse or s3fs’ll install all dependencies for fuse and s3fs.  Install the required packages to system use following below command.

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

Download and compile latest version of fuse.

# cd /tmp/
# wget
# tar -xzf fuse-2.9.3.tar.gz
# cd fuse-2.9.3
# ./configure --prefix=/usr/local
# make 
# make install
# export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
# ldconfig
# modprobe fuse

Download and compile latest version of s3fs source code.After downloading extract the archive and compile source code in system.

# cd /usr
# wget
# tar -xzf s3fs-1.74.tar.gz
# cd s3fs-1.74
# ./configure --prefix=/usr/local
# make 
# make install

Now Setup Access Key

configure s3fs required Access Key and Secret Key of your S3 Amazon account (Change AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY with your actual key values).

–>  Click on AWS Menu -> Your AWS Account Name -> Security Credentials***
Create a new file in /etc with the name passwd-s3fs and Paste the access key and secret key in /etc/passwd-s3fs.

# vi /etc/passwd-s3fs








Give permissions to passwd-s3fs file

# chmod 600 ~/.passwd-s3fs

Mount s3bucket

Now mount s3 bucket using following set of below commands.

# mkdir /s3mount                <--- mount point  name
# chmod 777 /s3mount

# s3fs <s3bucket name> <mountpoint name>

Now check s3 bucket is mounted or not by below command

# df -Th /s3mount

That’s it. centos ec2 instance

Related Articles

RHCSA and RHCE Certification Guide

Linux Foundation Certification Course Content

Thanks for your wonderful Support and Encouragement


Ravi Kumar Ankam

My Name is ARK. Expert in grasping any new technology, Interested in Sharing the knowledge. Learn more & Earn More

2 Responses

  1. blank Santosh Kumar Panigrahi says:

    Nice article.

    Have one Concern :

    Copying files of size more than 1 TB on the S3 Bucket when mounted on a Linux Box using fuse times out.

    Didn’t find a solution yet,even from the AWS guys.

  2. blank Himanshu Gupta says:

    Do we have to make entry in the fstab?

Leave a Reply

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