So after you are done with that, we can now move on to mount S3 as the file system for the EC2 instance.

An S3 bucket can be mounted in an AWS instance as a file system known as S3fs. S3fs is a FUSE file-system that allows you to mount an Amazon S3 bucket as a local file-system. It behaves like a network-attached drive, as it does not store anything on the Amazon EC2, but the user can access the data on S3 from the EC2 instance.

Filesystem in Userspace (FUSE) is a simple interface for userspace programs to export a virtual file-system to the Linux kernel. It also aims to provide a secure method for non-privileged users to create and mount their own file-system implementations.

S3fs-fuse project is written in python backed by Amazons Simple Storage Service. Amazon offers an open API to build applications on top of this service, which several companies have done, using various interfaces (web, sync, fuse, etc.).

Follow the below steps to mount your S3 bucket to Your Linux Instance.

This Tutorial assumes that you have a running Linux EC2 instance on AWS with root access and a bucket created in S3, which is to be mounted on your Linux Instance. You will also require an Access and Secret key pair with sufficient permissions of S3 or an IAM access to generate or Create it.

We will perform the steps as a root user. You can also use the sudo command if you are a regular user with sudo access. So let us get started.

Set up everything properly

export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_COLLATE=C
export LC_CTYPE=en_US.UTF-8

run this to make sure.

Step-1

For CentOS or Red Hat

yum update all

For Ubuntu

apt-get update

#ec2 #s3 #s3-bucket #terraform #aws

How to Mount S3 Bucket on an EC2 Linux Instance
7.10 GEEK