AWS CloudLinux

How to Mount S3 Bucket on Linux Instance

Mount S3 bucket on Linux instance as a filesystem and manage it using SFTP

In this tutorials, learn how to mount s3 bucket on Linux instance. There was one requirement where the client wants to access files from s3bucket on Linux AWS EC2 box, where they can easily manage all files stored in s3bucket via SFTP protocol (SFTP any tools).

We will explain to you how to mount s3 bucket on Linux instance as a filesystem and you can manage s3bucket (upload/download/delete files) using SFTP. You can use tools for access S3bucket using SFTP protocol like SFTP, WinSCP, Filezilla, cmd and etc…

S3FS is a FUSE (File System in User Space) based solution to mount an Amazon S3 buckets, you can use the s3 bucket as it just drives which is attached as another hard disk to the Linux system. you can use basic storage command such as cp, rm, mv, ls as a Unix basic commands.

You can also list/delete/upload/download files without attaching s3bucket to Linux system using s3cmd/aws s3 cli or you can use s3fox plugins where you can manage s3bucket via firefox browser.

Steps to mount AWS S3 to Linux Server (EC2) using s3fs file system

Assuming you have already launched Linux server in AWS Cloud, else launch a new Amazon ec2 box.

Prerequisite to mount s3bucket to Linux server

  • Install dependencies
  • Download s3fs
  • Install s3fs

Steps to install the s3fs on Centos/RHEL/Amazon Linux

Login to EC2 Linux Server via SSH

Install required dependencies for Centos/RHEL/Amazon Linux

#For Ubuntu Systems

Now compile s3fs and install it with below command:

Step to mount S3 Bucket to Linux File System

You need root privileges, so login with root user or switch to root user:

Create IAM user you need access-key and secret key for s3fs, store key details in /etc/passwd-s3fs

(Replace <access-key-id> and <secret-access-key> with the actual IAM user keys)

Create Dir to mount s3bucket:

For example:

(Replace the leading <s3-bucket> with your AWS s3 bucket name and the /mnt/<test-bucket> with the mount point which you have created)

Use-mention command to mount the partition which has entered in fstab and here we just now added AWS S3 bucket details to mount on Linux:

Verify the S3 bucket mounted on Linux server

In the command output, you can see the bucket name which you have to add an entry in /etc/fstab.

As per system admin best practice, you must add the entry of each filesystem which you have added newly to the Operating System

In this tutorials, you learn how to mount s3 bucket on Linux instance.

Related Articles

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.


Adblock Detected

Please consider supporting us by disabling your ad blocker
%d bloggers like this: