Mounting Amazon S3 bucket into Amazon EC2 [ CentOs ]


Recently, I have been working on Amazon Web Services. I have been using Amazon S3, RDS, EC2 extensively.  For my recent project that I am working on, I have a WowzaMediaServer running on a m1.xlarge instance [ cent os 6.3  x86_64 ]. And I have a bucket named fiercecaptial. What my situation is I need to mount the bucket in Amazon S3 into Amazon EC2 instance. Now, my friend to help me do this is s3fs, which I need to download. Well I suggest you to download the latest version.
Once the latest version is downloaded what we need to do is extract the file. 'tar -xvzf filename.tar.gz' would help you extract the files. And the other step to get it installed is pretty easy:
./configure --prefix=/usr
make
sudo make install
These are the common steps that you need to follow and this should help you get your s3fs installed.  And incase you have not installed your development tools that are required to compile the souce code then you need to run the following commands:
sudo yum groupinstall "Development Tools"
sudo yum install curl-devel libxml2-devel openssl-devel mailcap
There one more thing you might find problems if you are using the latest s3fs source code. That is the version of Fuse. To the date of this post the recent version of fuse found in the repository of Cent Os is 2.8.3 but the latest s3fs requires fuse of the version 2.8.4. To download 2.8.4 version of fuse use the following command:
wget "http://downloads.sourceforge.net/project/fuse/fuse-2.X/2.8.4/fuse-2.8.4.tar.gz?r=&ts=1299709935&use_mirror=cdnetworks-us-1"
Once downloaded extract with the command:
tar -xvzf fuse-2.8.6.tar.gz 
change the directory:
cd fuse-2.8.6 
Now compile and install:
./configure --prefix=/usr
make
sudo make install
export PKG_CONFIG_PATH=/usr/lib/pkgconfig
pkg-config --modversion fuse
The last command should print the version of fuse to be 2.8.4.

Once you have s3fs installed now, you need to get the access key and access secret of Amazon s3. And you can create a file /etc/passwd-s3fs with permission 600. The passwd-s3fs file should contain the key and secret in a single line separated by ':' e.g.
bwbshjklwmsysiene7hh:jdjbeeosakw3389
Now create a directory where the bucket is to be mount lets say it buck_contents. And then you can use the command:
s3fs bucketname directory_on_which_bucket is mount
e.g.
s3fs fiercecaptial buck_contents


Comments

Popular posts from this blog

Automate file upload in Selenium IDE

How To Install and Configure Nextcloud