Day 89 Task: Project-10
Explore the Power of AWS, S3, EC2, and S3FS in a Project
Project: Mounting AWS S3 Bucket on Amazon EC2 Linux Using S3FS
This project is an excellent introduction to Amazon Web Services (AWS) and will teach you how to mount an AWS S3 bucket on an Amazon EC2 Linux instance using S3FS. By following these steps, you'll gain hands-on experience with AWS, S3, EC2, and S3FS.
🔶 Task: Mounting AWS S3 Bucket on Amazon EC2 Linux Using S3FS
Create an IAM User:
Log in to your AWS Management Console.
Navigate to the IAM (Identity and Access Management) service.
Click on "Users" in the left-hand menu and then "Add user."
Enter a username.
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.
Install and Configure aws-cli:
Log in to your EC2 Linux instance.
Install the AWS Command Line Interface (aws-cli) if not already installed.
sudo apt update sudo apt install awscli -y
Configure aws-cli with the IAM user's credentials:
- Enter your access key, secret key, default region, and preferred output format.
Test AWS Configuration:
Confirm that aws-cli is correctly configured by running a simple AWS command. For example:
aws s3 ls
This command should list your S3 buckets.
Now, create a bucket from the AWS console.
Task 2: Mount the S3 Bucket Using S3FS
You can install S3FS on your EC2 instance to mount S3 buckets like a file system.
sudo apt-get update sudo apt-get install s3fs -y
Create a directory where you want to mount the S3 bucket. For instance, create a directory named "bucket" in your home directory.
Add some 2–3 files in
:~/bucket$ touch Chandresh.txt Project-10.txt Day89.txt
Mount your S3 bucket using S3FS. Replace
your-bucket-namewith the name of your S3 bucket:
aws s3 sync ~/bucket <your-bucket-name> aws s3 sync /home/ubuntu/bucket s3://day89-project-10
Access S3 Data:
Your S3 bucket is now mounted in the "bucket" directory.
You can navigate and access the S3 bucket's contents as if they are local files on your EC2 instance.
In this project, you've learned how to set up AWS resources, configure aws-cli, install S3FS, and mount an AWS S3 bucket on an Amazon EC2 Linux instance. This knowledge can be invaluable in various scenarios where you need to interact with and use AWS S3 storage as a seamless part of your Linux-based infrastructure.
Explore further and consider automating tasks, managing access permissions, and integrating S3 bucket data into your applications running on EC2 instances. AWS offers a wealth of services, and this project is just the beginning of your journey into the cloud.
Happy Learning :)
Stay in the loop with my latest insights and articles on cloud ☁️ and DevOps ♾️ by following me on Hashnode, LinkedIn (https://www.linkedin.com/in/chandreshpatle28/), and GitHub (https://github.com/Chandreshpatle28).
Thank you for reading! Your support means the world to me. Let's keep learning, growing, and making a positive impact in the tech world together.
Did you find this article valuable?
Support CHANDRESH PATLE by becoming a sponsor. Any amount is appreciated!