Mounting s3 bucket on an instance

Mounting s3 Bucket on an AWS Instance

There are many ways of achieving this, one method is to use this plug.

Here are the steps anyways: Install prerequisites, clone this source, configure, make and install:

sudo apt-get install build-essential libfuse-dev fuse-utils libxml2-dev mime-support automake libtool 
sudo apt-get install libcurl4-openssl-dev 
# See (*2)  git clone https://github.com/s3fs-fuse/s3fs-fuse cd s3fs-fuse/ ./autogen.sh ./configure --prefix=/usr --with-openssl
# See (*1) make sudo make install
sudo apt-get install build-essential libfuse-dev fuse-utils libxml2-dev mime-support automake libtool 
sudo apt-get install libcurl4-openssl-dev 
# See (*2)  git clone https://github.com/s3fs-fuse/s3fs-fuse cd s3fs-fuse/ ./autogen.sh ./configure --prefix=/usr --with-openssl
# See (*1) make sudo make install

once installation is complete then you need to create a file that contains the access key and secret key that can be found on your amazon account.

So to create this file is like so:

vi /etc/passwd-s3fs
# the file should have accesskey:secretkey
<accesskey>:<secretkey>

The above account must have access to s3 bucket. If you have many account this field should be as follows: bucketname:accesskey:secretkey

Change the permission of password file

chmod 640 /etc/passwd-s3fs

now create a directory to mount S3bucket e.g. s3 then do

chown ubuntu:ubuntu s3
sudo /usr/bin/s3fs -o allow_other <mybucket>  s3

if you want to mount on a directory inside s3 then do this:

mkdir <thedirname> 
cd s3
sudo /usr/bin/s3fs -o allow_other <mybucket>  <thedirname>

You should be able to see the content of your becket. If you are having problems and want to unmunt type this command:

umount /path