Lately I have been doing a lot of work with AWS t1.micro instances running Amazon Linux which seem to be based on RHEL/Centos. Both Railo and ACF do a good job of interacting with Amazon S3 storage which definitely makes our jobs as developers easier, but what if you wanted to mount your S3 storage locally to have access to your files at the system level so you could actually work with them? Luckily there is an open-sourced s3fs project that will allow you to do just that.
At the time of this writing, the current file release is s3fs-1.59.tar.gz. The unfortunate thing is, s3fs requires Fuse 2.8.4 and the newest version available in the package repos is Fuse 2.8.3. The first step is to get the newest version of Fuse and get it on the server.
Once the download is completed, extract it:
tar -xzvf fuse-2.8.4.tar.gz cd fuse-2.8.4
If you are still on a stock install of Amazon Linux, at this point we will need some tools to get everything configured and compiled.
sudo yum groupinstall "Development Tools"
This will install the tools we need for a moment. However, we will need to install some more packages to get s3fs to compile. We might as well get them now:
sudo yum install curl-devel libxml2-devel openssl-devel mailcap
Now we should still be in the the fuse-2.8.4 directory, so now it is time to configure and compile Fuse.
./configure --prefix=/usr make sudo make install sudo ldconfig export PKG_CONFIG_PATH=/usr/lib/pkgconfig pkg-config --modversion fuse
If everything went as planned, pkg-config should return 2.8.4.
Next we need to download and install s3fs. First we need to get and extract the archive:
cd wget http://s3fs.googlecode.com/files/s3fs-1.59.tar.gz tar -xzvf s3fs-1.59.tar.gz cd s3fs-1.59 ./configure --prefix=/usr make sudo make install
The installation should now be in working order. The next step will be to decide how you would like to create your password file for s3fs. You can either create a site wide password file /etc/passwd-s3fs or you can create one just for your user account ~/.passwd-s3fs. The files are required to be secure, so if you go with the system wide password file be sure to chmod 640 /etc/passwd-s3fs or if you want to use your user account, chmod 600 ~/.passwd-s3fs. The format for the files is the standard [AccessKey]:[SecretKey].
Finally, lets map the drive to a local directory. In my home directory I created a folder name s3storage that will be my mount point. We create the mount with
s3fs [bucketname] ~/s3storage -o default_acl=public-read
I have only set this up on one machine so I still do not have the install down completely, but I was able to get this up and running successfully. All the steps above are more or less from memory so I apologize for any hazy steps. I will correct as needed.