Mount AWS S3 Bucket On Amazon EC2-Instance
Last Updated :
25 Oct, 2023
AWS S3 storage service is used for object storage these objects can be termed a file and it's metadata that briefs about it. Well, to store the files and documents we need to create a S3 bucket. It's like a container that stores the files. These files can be pictures, txt file, documents, static web page files, etc. AWS S3 object storage is mostly used to store backup or archived files.
Why to Mount an AWS S3 Bucket on an AWS EC2 Instance?
- Easy Access: Mounting an S3 bucket on your EC2 instance can make it easier to access and manage your data because you can use the required file and interact with objects in the bucket.
- Easy to store backups Mounting S3 to your EC2 instance makes it easy to back up or restore files directly from your instance.
- Cost-effective: It is cost effective to mount and use S3 that using it over the internet.
- Security: By mounting it, we can attach IAM role and policy to the instance and restrict access to s3 bucket according to the need.
How to mount an S3 bucket on an EC2 Instance?
We are going to use Mountpoint for Amazon S3. This is an open source file client that makes it easy to directly connect to Amazon S3.
Step by Step guide to Mount AWS S3 Bucket on Amazon EC2-Instance
Step 1: Log in to your Console and search S3 --> Click on create bucket

Step 2: Give it a unique name(follow S3 naming convention) -->Choose region(Keep other things as it is)--> Click on create

Step 3: Now open the bucket--> Click on Upload --> Choose on Add file--> select file from system -->Click on Upload.


Step 4: Now let's create an instance, for that
Click on "launch instance"--> Give it a name--> Choose AMI(Here I have taken Linux 2 kernel)-->Choose t3.micro as instance type-->Go to advanced, In IAM instance profile--> Click on "Create new IAM profile"

Step 5:Click on Create role-->Click on AWS service--> in use case select EC2--> Now in permission search and select "S3fullaccess"-->Click Next-->give it a Name and Create

.png)

Step 6: Now in launch template--> In IAM instance profile--> refresh and select newly created IAM role.
Step 7: Now, after launching
SSH into the server.

Step 8: Run following coomands
# sudo su
# wget https://s3.amazonaws.com/mountpoint-s3-release/latest/x86_64/mount-s3.rpm
.png)
Install the mount-s3
# yum install ./mount-s3.rpm

Now, use this command to list of all the buckets present in your AWS S3
# aws s3 ls

Now create directory
# mkdir {name of directory}

Now to mount the required bucket
# mount-s3 s3bucketsaws[name of the bucket] mountedfolder/[directory where to be mounted]
Now, go to the directory and do "ls"
you can find your files.

That's all on how and why to mount S3 bucket.
Similar Reads
How to Mount Amazon S3 Bucket as a Windows Drive Mounting an Amazon S3 as a Windows drive can be inconceivably valuable for different purposes, for example, consistent document access, reinforcement arrangements, and reconciliation with neighborhood applications. This article gives a thorough aid on the most proficient method to accomplish this, m
6 min read
How to Connect to Amazon Linux Instance Using SSH? Pre-requisites: AWS, SSH TOOLS AWS stands for Amazon Web Services, and it is a cloud computing platform provided by Amazon. AWS provides a range of cloud-based services, including computing power, storage, databases, analytics, machine learning, and many other resources that businesses and individua
3 min read
Amazon S3 - Creating a S3 Bucket Amazon Simple Storage Service (Amazon S3) or Amazon S3 is an object type, high-speed or with minimal latency, low-cost and scalable storage service provided by AWS. S3 also allows you to store as many objects as you'd like with an individual object size limit of five terabytes. It provides 99.999999
3 min read
How To Configure SSL For Amazon S3 Bucket? Amazon S3 bucket is like a virtual storage container in the cloud where we can securely store and manage our files like images, videos, documents, etc. Configuring SSL (Secure Socket Layer) for our S3 bucket is important, as we store our valuable information in it. In simple terms, it is like settin
3 min read
How To Make Amazon S3 Bucket Public ? This article intends to make the readers aware of making an existing Amazon S3 bucket public. S3 or Simple Storage Service is a data storage feature used for storing, manipulating, and retrieving data over a virtual environment. This service is issued by Amazon Web Services which is a cloud computin
3 min read
Using Amazon S3 Glacier in the AWS CLI Amazon S3 Glacier is now incorporated under the umbrella of Amazon S3 Intelligent-Tiering as the Glacier and Deep Archive storage classes. It is a very cost-effective, durable, and secure service for archiving data meant for cold storage, with retrieval times of minutes to hours, targeting long-term
8 min read