Friday, July 24, 2015

Mount S3 Bucket in Ubuntu EC2





Execute command “apt-get update”. 
Install Prerequisite using following command
a.      apt-get install build-essential git libfuse-dev libcurl4-openssl-dev libxml2-dev mime-support automake libtool
b.      apt-get install pkg-config libssl-dev

  Download and Install s3fs using following command.
a.      wget https://s3fs.googlecode.com/files/s3fs-1.74.tar.gz (use latest version)
b.      tar xzf s3fs-1.74.tar.gz (change according to your version)
c.       cd s3fs-1.74 (change directory to extracted s3fs version)
d.      ./configure
e.      make
f.        make install

     Setup Access Key using following command
a.      echo AWS_ACCESS_KEY_ID:AWS_SECRET_ACCESS_KEY > ~/.passwd-s3fs
                                                              i.      AWS_ACCESS_KEY_ID = your S3 access key ID
                                                            ii.      AWS_SECRET_ACCESS_KEY = your S3 Secret Key
    Change Permission on the file
a.      chmod 600 ~/.passwd-s3fs  (Mandatory don’t change value)

      Check your ~/.passwd-s3fs file detail using following command and make sure the key is represented must be valid.
a.      cat  ~/.passwd-s3fs
     Mount S3 Bucket using following Command
a.      mkdir /tmp/cache
b.      mkdir /mnt/BucketS3
c.       chmod 777 /tmp/cache /mnt/BucketS3
d.      s3fs -o use_cache=/tmp/cache <your S3 bucket name> /mnt/BucketS3

      You are done, execute following command to list out the file in mounted drive .
a.      ls –l  /mnt/BucketS3/

No comments:

Post a Comment