HOWTO Mount S3 bucket into EC2 instance

I would like to share my experience mounting a S3 bucket into a Linux EC2 instance.

The steps I followed were:

  • 1.- Download the latest version of s3fs (which is a FUSE backend for S3) from https://code.google.com/p/s3fs/downloads/list or
    wget https://s3fs.googlecode.com/files/s3fs-1.71.tar.gz
    • tar zxf s3fs-r177-source.tar.gz
  • 2.- Unpack it: 
    • apt-get install build-essential libxml2-dev libfuse-dev libcurl4-openssl-dev
  • 3.- Install dependencies for building. In my Ubuntu AMI was: 
    • cd s3fs; make install
  • 4.- Build and install the code (this copies the binary s3fs to /usr/bin): 
    •  touch /etc/passwd-s3fs && chmod 640 /etc/passwd-s3fs && echo 'AccessKey:SecretKey' > /etc/passwd-s3fs        
  • 5.- Edit a config file for storing your keys (you can check them out under AWS Menu -> Your Account -> Security Credentials)  Note: If you dont want to leave any trace of your secret key in your shell history, use a text editor to edit the file rather than echoing it.
    So where to find 
    'AccessKey:SecretKey'?
    Actually, you can download a file named 
    rootkey.csv and find that in it. 
  • 6.- Create a directory for mounting the S3 filesystem and mount it. Note that you can mount the s3fs anywhere you like:  /usr/bin/s3fs bucketname /mnt/mountpoint
  • 7. Check it is working correctly:  grep s3fs /etc/mtab

0 comments

Popular Posts

无觅相关文章插件,迅速提升网站流量