Mount S3 into EC2 (micro) instance

This quick howto describes how to mount Amazon Simple Storage (S3) into Amazon Elastic Compute Cloud (EC2) instance. In my case is it micro instance with Basic 64-bit Amazon Linux AMI 2011.09.

First of all download s3fs

wget http://s3fs.googlecode.com/files/s3fs-1.61.tar.gz

Decompress it

tar -xzf s3fs-1.61.tar.gz

Now install dependencies. This step can be different for another Amazon Machine Image.

sudo yum install make glibc-devel gcc gcc-c++ libxml2-devel libcurl-devel fuse-devel openssl-devel

Compile it and install

cd s3fs-1.61
make
sudo make install
sudo ln -s /usr/local/bin/s3fs /usr/bin/s3fs

Configure it

sudo touch /etc/passwd-s3fs && sudo chmod 640 /etc/passwd-s3fs
sudo vim /etc/passwd-s3fs (add your credentials in format accessKeyId:secretAccessKey)

Mount it

sudo mkdir /mnt/s3
sudo s3fs S3_BUCKET_NAME /mnt/s3 -o allow_other

allow_other option allows other users than root to access mounted bucket.

You can umount bucket using sudo umount /mnt/s3.

Comments