DevOps Project 10 Mounting S3 Bucket on EC2 Linux using S3FS
Day 89 of #90daysofdevops challenge
Project Description
In this AWS Mini Project, you will learn how to Mount an AWS S3 Bucket on an Amazon EC2 Linux instance using S3FS. The project provides a hands-on experience with Amazon Web Services (AWS) and covers key components such as AWS S3, Amazon EC2, and S3FS.
Through practical implementation, you will gain valuable insights into securely integrating AWS services, managing data storage in S3, and leveraging S3FS to enable seamless access and interaction between EC2 instances and S3 buckets.
Step 1: Create a New IAM User
Begin by creating a new IAM user in the AWS console. Go to the IAM service, click on "Users," and then "Add user." Enter the name of the new user and proceed to the next step.
Set permissions for the user. For this project, you can create a policy or use an existing one that allows S3 access. Review and create the user. Make sure to save the user's access key and secret access key, as you'll need these later.
Step 2: Create EC2 Instance
Create a new t2.micro
instance on AWS EC2
Install the AWS Command Line Interface (aws-cli) if not already installed.
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
Step 3: Install S3FS
After installing AWS CLI, proceed to install S3FS on the EC2 instance.
sudo apt install s3fs -y
Step 4: Create a Folder and Add Files
Create a folder named "bucket" at a location /home/ubuntu
on the EC2 instance. Add 1–2 files to this folder.
mkdir bucket
touch test1.txt test2.txt
Step 5: Create S3 Bucket
In the AWS console, create an S3 bucket with a suitable name.
Step 6: Configure AWS CLI
On the EC2 instance, configure the AWS CLI by running the command aws configure
and providing the Access Key and Secret Key obtained earlier.
Step 7: Sync Files to S3 Bucket
Run the below command to sync the files from the given location on the EC2 instance to the S3 bucket.
aws s3 sync /home/ubuntu/bucket s3://day89-s3bucket
Step 8: Verify the Sync
Refresh the objects inside the S3 bucket to confirm that all the files from the EC2 instance are successfully uploaded to the S3 bucket.
Congratulations on completing Day 89 of the #90DaysOfDevOps Challenge!
Today, you successfully mounted an AWS S3 bucket on an EC2 Linux instance using S3FS. This achievement has deepened your expertise in AWS, S3, EC2, and S3FS.
Stay tuned for tomorrow as we conclude this incredible journey with the final day of the challenge. Keep up the great work!