Did you know that you can navigate the posts by swiping left and right?

Mount An AWS S3 Bucket To A Local Linux File System

10 Nov 2016 . category: tech . Comments
#aws #s3 #bucket #linux #s3fs #ubuntu #nginx

I’m using s3fs which allows Linux and Mac OS X to mount an S3 bucket via FUSE.

INSTALLATION

For Ubuntu 14.04 only and nginx, modify yourself for other distros, web services.

Install dependencies:


sudo apt-get update
sudo apt-get install automake autotools-dev g++ git libcurl4-gnutls-dev libfuse-dev libssl-dev libxml2-dev make pkg-config

Let’s build s3fs:


git clone https://github.com/s3fs-fuse/s3fs-fuse.git
cd s3fs-fuse
./autogen.sh
./configure
make
sudo make install

Create a file storing the AWS keys required by S3 to allow your s3fs requests:


echo ACCESS_KEY_ID:SECRET_ACCESS_KEY/ > /path/to/s3_passwd
chmod 600 /path/to/s3_passwd

We are now ready to mount your S3 bucket. Mount the S3 bucket using the www-data user permission. Uid=33 and gid=33 is an example.


mkdir /path/to/mouth/
s3fs -o allow_other,uid=33,gid=33,use_cache=/etc/ -o passwd_file=/path/to/s3_passwd bucket_name /path/to/mount/

Manual unmount the virtual drive using umount command:


umount /path/to/mouth

Automatically mouth the S3 bucket when the server boots by adding an entry to /etc/fstab using the following command:


bucket_name /path/to/mount fuse.s3fs _netdev,allow_other,uid=33,gid=33 0 0

Me

Harry Nguyen is an awesome person. Abosolutely true!.