Introduction
S3FS is a fuse filesystem you can use to mount s3 bucket on your local filesystem.
In this guide I will show how to quickly install s3fs and use it in /etc/fstab to mount it on your local server.
Tested On
OS: Amazon Linux AMI release 2012.03
S3FS version: 1.61
Hardware: Virtual Machine (AWS AMI)
Install S3FS
- Install prerequisite packages
yum install kernel kernel-devel libxml2-devel curl-devel pkgconfig fuse openssl-devel subversion fuse-devel automake -y
- Download and Install S3FS
cd /usr/local/src svn checkout https://s3fs.googlecode.com/svn/trunk/ s3fs-read-only cd s3fs-read-only ./autogen.sh && ./configure && make && make install
- Configure your s3 credentials in s3fs configuration file. You need to have an account configured with access keys and with write access rights to s3.
vi /etc/passwd-s3fs accessKeyId:secretAccessKey
- If you have different users for different buckets you can use the following syntax
bucketName:accessKeyId:secretAccessKey
- Change permission to s3fs configuration file
chmod 640 /etc/passwd-s3fs
- Try to mount your buacket
mkdir /mnt/s3 s3fs mybucket /mnt/s3 df -h /mnt/s3 echo test1 > /mnt/s3/test
- Remove test file and unmount your bucket from a temporary location
rm -f /mnt/s3/test umount /mnt/s3
- Configure /etc/fstab to mount your bucket at startup
vi /etc/fstab ... s3fs#mybucket /data fuse allow_other 0 0 ...
- mount your new bucket
mount /data
For more information about S3FS please visit https://code.google.com/p/s3fs