How to mount AWS S3 bucket into AWS EC2 instance Step by Step

In this article i will go thru the steps required to mount an AWS S3 Bucket to an Linux EC2 instance.

I assume who will follow this article will already have an AWS account setup and knows already what an EC2 & S3 Bucket are.

A – For this you will need to install fuse and s2fs packages 

Follow the steps bellow to do this (this was done using a Centos 6.+ Linux Box)

 B – After you have installed s2fs & fuse you will need setup the AWS account access.

  • run the following commands as the root user.

 C – Next you will need to create and user that will manage your S3 storage.

Follow this steps to see how to create a new user that will have S3 Storage administration privileges.

1 – Go to Identity and Access Management Service(IAM)

ScreenHunter_01 Jun. 22 18.25

2 – Select the users tab.


ScreenHunter_02 Jun. 22 18.25

3 – Choose to create a new user. 

ScreenHunter_03 Jun. 22 18.26

4 – Give the user a name, i will call it “s3_access”, you can call it the way you want.

ScreenHunter_04 Jun. 22 18.26

5 –  When the user is created AWS will prompt you with the users credentials.

Very important : save them on your computer  or “memorize” them.

ScreenHunter_05 Jun. 22 18.26


Similar Article  How to Install Google Cloud Storage tool GSUTIL on Linux CentOS

They look something like this, where you have a column header and their respective values. We only will need the Access Key ID & Secret Access Key.

ScreenHunter_06 Jun. 22 18.27



6 – Setup user policy rights.

  • the user was created but is “naked”, meaning it has no rights.
  • you need to go to the “Policies” tab and look for the AmazonS3FullAccess Policy

ScreenHunter_07 Jun. 22 18.33


  • Once selected you need to attach/”grant” the policy to user(in our case the s3_access user).


ScreenHunter_08 Jun. 22 18.33


  • Select the s3_access user from the list of users and select the button “Attach Policy“. Now our s3_access user has full control over our S3 storage resources.


ScreenHunter_09 Jun. 22 18.34

 D – Next you need to alter the  file and put in your AWS S3 credentials

  • just copy and paste the command bellow after you edit the Access Key and the Secret Access Key with your own values from the S3_access user.


E – Create mount point

 F – Mount the s3 bucket device on your mount point

Now you can use the S3 bucket as your own file system.

Note : – is important that if you want this to always be mounted when you machine reboot you need to put this entry in your /etc/fstab file


Similar Article  How to Recover a lost node in Vertica database

To test the edited /etc/fstab file unmount the s2fs device and run umount -a, this command should mount your device the same way the bootloader does.

  • nice the device was mounted and this way we validated that it will come up with the bootloader.

I hope this was helpful and i appreciate if you would like, subscribe or share our posts. I it is just a click


No Comments
Leave a Comment

%d bloggers like this: