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 or
    • 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 
    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


Popular Posts