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 packages.you’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 http://downloads.sourceforge.net/project/fuse/fuse-2.X/2.9.3/fuse-2.9.3.tar.gz # 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 https://s3fs.googlecode.com/files/s3fs-1.74.tar.gz # 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 bwbshjklwmsysiene7hh:jdjbeeosakw3389 :wq
# echo AWS_ACCESS_KEY_ID:AWS_SECRET_ACCESS_KEY > ~/.passwd-s3fs
# chmod 600 ~/.passwd-s3fs
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
Thanks for your wonderful Support and Encouragement
Stay Connected With Us. Learn More and Earn More