{"id":5466,"date":"2015-12-21T12:49:25","date_gmt":"2015-12-21T04:49:25","guid":{"rendered":"http:\/\/rmohan.com\/?p=5466"},"modified":"2015-12-21T12:49:53","modified_gmt":"2015-12-21T04:49:53","slug":"mount-s3-bucket-in-linux-ec2-instance","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=5466","title":{"rendered":"mount s3 bucket in linux EC2 instance"},"content":{"rendered":"<p>if you have not created a s3 bucket kindly go through with EC2 documentation.The documentation is very clear and easy to understand .This is the link how to create S3bucket<\/p>\n<p>After creating a new bucket follow the given below steps.<\/p>\n<p>Step 1: Download the latest s3fs package from S3fs link<\/p>\n<p>http:\/\/s3fs.googlecode.com\/files\/s3fs-1.63.tar.gz<\/p>\n<p>Step 2: Untar the package in EC2 instance.<\/p>\n<p>tar -xvzf s3fs-1.63.tar.gz<\/p>\n<p>Step 3: If it is new centos or ubuntu instance. Update the system .<\/p>\n<p>For CentOS or Red Hat<\/p>\n<p>yum update all<\/p>\n<p>For Ubuntu<\/p>\n<p>sudo apt-get update<\/p>\n<p>Step 4: Now install the dependencies.<\/p>\n<p>In CentOS or Red Hat<\/p>\n<p>yum install gcc libstdc++-devel gcc-c++ fuse fuse-devel curl-devel libxml2-devel openssl-devel mailcap<\/p>\n<p>In Ubuntu or Debian<\/p>\n<p>apt-get install build-essential gcc libfuse-dev fuse-utils libcurl4-openssl-dev libxml2-dev mime-support build-essential libcurl4-openssl-dev<\/p>\n<p>Step 5: Now change to extracted directory<\/p>\n<p>cd s3fs-1.63<\/p>\n<p>Step 6: Now compiling<\/p>\n<p>.\/configure\u00a0 &#8211;prefix=\/usr<\/p>\n<p>make<\/p>\n<p>make install<\/p>\n<p>Step 7: To check where s3fs command is placed in O.S. It will also tell you the installation is ok.<\/p>\n<p>which s3fs<\/p>\n<p>Step 8: Now getting the access key and secret key.<br \/>\nClick on AWS Menu -&gt; Your AWS Account Name -&gt; Security Credentials<\/p>\n<p>Note: The option is at top Right corner of the aws console page<\/p>\n<p>Here you can see access key and secret key (secret key is visible when you click on show tab)<\/p>\n<p>Copy these both keys seperately<\/p>\n<p>Step 9 : Create a new file in \/etc with the name passwd-s3fs<\/p>\n<p>Paste the access key and secret key in this manner .<\/p>\n<p>accesskey:secretkey<\/p>\n<p>Note: colon (:) is require in between of both keys.<\/p>\n<p>for eg.<\/p>\n<p>Access key: bwbshjklwmsysiene7hh<\/p>\n<p>Secret key: jdjbeeosakw3389<\/p>\n<p>vi \/etc\/passwd-s3fs<\/p>\n<p>bwbshjklwmsysiene7hh:jdjbeeosakw3389<\/p>\n<p>save and exit from file.<\/p>\n<p>Note: I just gave an eg. of keys by randomely typing the letters. But you have to only paste the keys which you have obtained from &#8220;Security Credential&#8221; tab -see step 8<\/p>\n<p>Step 10: change the permission of file<\/p>\n<p>chmod 640 \/etc\/passwd-s3fs<\/p>\n<p>Step 11 : now create a directory to mount S3bucket<\/p>\n<p>mkdir \/mys3bucket<\/p>\n<p>Step 12: Now mount the s3 bucket<\/p>\n<p>s3fs bucketname \/mys3bucket<\/p>\n<p>Note: you can get bucket name from S3 management console.<\/p>\n<p>Step 13: To check mounted s3 bucket<\/p>\n<p>df -Th \/mys3bucket<\/p>\n<p>Step 14 : If you already had some data in s3bucket and it is not visible then you have to set permission in ACL at S3 AWS management console for related s3 bucket.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>if you have not created a s3 bucket kindly go through with EC2 documentation.The documentation is very clear and easy to understand .This is the link how to create S3bucket<\/p>\n<p>After creating a new bucket follow the given below steps.<\/p>\n<p>Step 1: Download the latest s3fs package from S3fs link<\/p>\n<p>http:\/\/s3fs.googlecode.com\/files\/s3fs-1.63.tar.gz<\/p>\n<p>Step 2: Untar the [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[49,73,4,17],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/5466"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5466"}],"version-history":[{"count":2,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/5466\/revisions"}],"predecessor-version":[{"id":5468,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/5466\/revisions\/5468"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5466"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5466"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5466"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}