August 23, 2019 / Nirav Shah
<h2><strong>How To Mount S3 Bucket On AWS EC2 Step By Step </strong></h2>
<h2><b>What is s3fs ?</b></h2>
s3fs is a FUSE filesystem that enables you to mount an Amazon S3 pail as a nearby filesystem. It stores documents locally and straightforwardly in S3 (i.e., you can utilize different projects to get to similar records). The most extreme size of articles that s3fs can deal with relies upon Amazon S3. For instance, up to 5 GB when utilizing single PUT API. What’s more, up to 5 TB is supported when Multipart Upload API is utilized.
<b>Important Note.</b>
<b>Your kernel must support FUSE, kernels earlier than 2.6.18-164 may not have FUSE support. Virtual Private Servers (VPS) may not have FUSE support compiled into their kernels.</b>
<h2><b>Main Requirements For s3fs on AWS S3 Bucket are as follow.</b></h2>
<ol>
<li>Amazon Web Service Account.</li>
<li>AWS ACCESS KEY ID of Amazon Web Service Account (Provided under My Security Credentials in the Amazon Web Service Account).</li>
<li>AWS SECRET ACCESSKEY of Amazon Web Service Account (Provided under My Security Credentials in the Amazon Web Service Account).</li>
<li>1 Object to be placed in a S3 Bucket on Amazon Web Service which can be in anyformat Image,Video,Music.</li>
</ol>
<h2><b>Steps which should be followed to enable S3fs on your instance and s3 bucket in AWS Account.</b></h2>
<b>Step 1</b>
<div style=”padding-left: 15px;”>
Log In to your AWS Account.
<img class=”img-responsive” style=”padding-bottom: 30px;” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/Screenshot1.png” />
You can log in to your AWS Account by your E-Mail Id & Password after registrating in the AWS(Amazon Web Service).
<img class=”img-responsive” style=”padding-bottom: 30px;” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/Screenshot2.png” />
</div>
<b>Step 2</b>
<div style=”padding-left: 15px;”>
Launch ubuntu server
Launch instance in AWS is very simple just need to follow the given steps under.
Find Service drop down menu which is located on the right side on the AWS logo in the main dashborad.
<img class=”img-responsive” style=”padding-bottom: 30px;” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/Screenshot3.png” />
Click on EC2 under compute section.
<img class=”img-responsive” style=”padding-bottom: 30px;” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/Screenshot4.png” />
Select Launch instance which is present in create instance tag Note (Please Verify that you are under the region which is closer to you).
<img class=”img-responsive” style=”padding-bottom: 30px;” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/Screenshot5.png” />
There are more than 400 type of instance avalible in AWS Select Ubuntu Server 18.04(This is the latest version of ubuntu systems).
<img class=”img-responsive” style=”padding-bottom: 30px;” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/Screenshot6.png” />
Choose the type of instance you want to build virtually.
<img class=”img-responsive” style=”padding-bottom: 30px;” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/Screenshot7.png” />
Configure Instance Details(Field you need to check are as under).
Number of instances(i.e. the number of instance you want to Launch with the same configration by default this number is 1).
Network (i.e. under which network policy are you in. In AWS this is called VPC (Virtual Private Cloud) you can change it or can keep it as default).
Subnet (i.e. this is the availability zone where you want your to Launch your instance).
IAM Role (i.e. the role given to a specific person/group to manage a services).
<img class=”img-responsive” style=”padding-bottom: 30px;” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/Screenshot8.png” />
Add Storage (i.e. to add a extra storage capacity to your instance).
<img class=”img-responsive” style=”padding-bottom: 30px;” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/Screenshot9.png” />
Add Tags (i.e. for giving the name to your instance basically for your knowledge).
<img class=”img-responsive” style=”padding-bottom: 30px;” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/Screenshot10.png” />
Configure Security Group (i.e. which ports should be allowed to the instance are stated under this service).
<img class=”img-responsive” style=”padding-bottom: 30px;” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/Screenshot11.png” />
Click On Review And Launch (verify all the details of the instance).
<img class=”img-responsive” style=”padding-bottom: 30px;” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/Screenshot11.png” />
Launch the instance (Your instance is ready to use).
<img class=”img-responsive” style=”padding-bottom: 30px;” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/Screenshot12.png” />
You will get a key to connect your server.
</div>
<b>Step 3</b>
<div style=”padding-left: 15px;”>
Create a S3 Bucket
You can find S3 service under the storage catagory in the service drop down menu.
<img class=”img-responsive” style=”padding-bottom: 30px;” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/Screenshot13.png” />
Click on create bucket.
<img class=”img-responsive” style=”padding-bottom: 30px;” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/Screenshot14.png” />
Name the bucket as you want (In my case i have named my bucket testbucketeternal1234).
<img class=”img-responsive” style=”padding-bottom: 30px;” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/Screenshot15.png” />
Click on create button and this will create the bucket.
<img class=”img-responsive” style=”padding-bottom: 30px;” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/Screenshot16.png” />
<b>Upload 1 file in the S3 Bucket.</b>
Click on upload by going inside the bucket.
<img class=”img-responsive” style=”padding-bottom: 30px;” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/Screenshot17.png” />
A popup will come in which you have to add a file (Image,Video or Music).
<img class=”img-responsive” style=”padding-bottom: 30px;” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/Screenshot18.png” />
Click on Upload Button in the bottom of the pupup.
<img class=”img-responsive” style=”padding-bottom: 30px;” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/Screenshot19.png” />
</div>
<b>Step 4</b>
<div style=”padding-left: 15px;”>
Connect your ubuntu server with KEY command to connect the server is as under.
<img class=”img-responsive” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/carbon0.png” />
<img class=”img-responsive” style=”padding-bottom: 30px;” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/Screenshot24.png” />
</div>
<b>Step 5</b>
<div style=”padding-left: 15px;”>
Enter the root user by the following command.
<img class=”img-responsive” style=”padding-bottom: 30px;” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/carbon1.png” />
</div>
<b>Step 6</b>
<div style=”padding-left: 15px;”>
Update the ubuntu server by the following command.
<img class=”img-responsive” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/carbon2.png” />
<img class=”img-responsive” style=”padding-bottom: 30px;” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/Screenshot25.png” />
</div>
<b>Step 7</b>
<div style=”padding-left: 15px;”>
Install s3fs by the following command.
<img class=”img-responsive” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/carbon3.png” />
Install s3fs by the following command(If you are not in the root user).
<img class=”img-responsive” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/carbon4.png” />
<img class=”img-responsive” style=”padding-bottom: 30px;” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/Screenshot26.png” />
</div>
<b>Step 8</b>
<div style=”padding-left: 15px;”>
grant permission of you account by the following command.
<img class=”img-responsive” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/carbon5.png” />
<img class=”img-responsive” style=”padding-bottom: 30px;” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/Screenshot27.png” />
</div>
<b>Step 9</b>
<div style=”padding-left: 15px;”>
State the path where you want to show your S3 bucket by the following command.
<img class=”img-responsive” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/carbon6.png” />
<img class=”img-responsive” style=”padding-bottom: 30px;” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/Screenshot28.png” />
If any Error comes run this command.
<img class=”img-responsive” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/carbon7.png” />
<img class=”img-responsive” style=”padding-bottom: 30px;” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/Screenshot29.png” />
</div>
<b>Step 10</b>
<div style=”padding-left: 15px;”>
Check the file where you have stored you S3 bucket and you will find the object which you have uploaded in the S3 Bucket.
<img class=”img-responsive” style=”padding-bottom: 30px;” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/Screenshot30.png” />
</div>
<b>Step 11</b>
<div style=”padding-left: 15px;”>
Now copy the same object in the same location where you have stroed your S3 by the following command.
<img class=”img-responsive” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/carbon8.png” />
<img class=”img-responsive” style=”padding-bottom: 30px;” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/Screenshot31.png” />
You can see that the new object will also appare in the AWS console under the S3 Bucketd.
<img class=”img-responsive” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/08/Screenshot32.png” />
</div>
<style type=”text/css”>
ul.listing li {<br /> list-style-type: disc !important;<br /> }<br /> ul.listing-new li {<br /> list-style-type: disc !important;<br /> }<br /> .blog-portion-one ul li.list-none {<br /> list-style-type: none !important;<br /> list-style: none !important;<br /> }<br /></style>

Nirav Shah is the Director of Eternal Web Pvt Ltd, an AWS Advanced Consulting Partner and certified Odoo Partner based in the UK. With over a decade of experience in cloud computing, digital transformation, and ERP implementation, Nirav helps enterprises adopt the right technology to solve complex business challenges. He specialises in AWS infrastructure, Odoo ERP, and web development solutions for businesses across the UK and beyond.
Have queries about your project idea or concept? Please drop in your project details to discuss with our AWS Global Cloud Infrastructure service specialists and consultants.