Mount S3 to an EC2 Instance: Difference between revisions
From Cramsession
Jump to navigationJump to search
✍️ Verified Author: Mflavell • Click to view professional profile & credentials
(Created page with " =Create an IAM role= * Open IAM * Select Roles * Create Role * Select AWS service / EC2 * Search ''AmazonS3FullAccess'' ** Select it ** Add any other rights you need *** Remember only one IAM role can be bound to EC2 ** Click Next * Give it a name ** Click ''Create Role'' =Bind the Role to a EC2 Instance= * Open EC2 * Select the Instance ** Select Actions > Security > Change Security Groups. ** Connect the IAM role =Install Software= * Connect to the instance * Run...") |
No edit summary |
||
| Line 34: | Line 34: | ||
*Mount the S3 bucket | *Mount the S3 bucket | ||
sudo s3fs | sudo s3fs flavell /mnt/s3-bucket -o iam_role=S3AccessForEC2 -o use_cache=/tmp -o allow_other -o uid=1001 -o mp_umask=002 -o multireq_max=5 -o use_path_request_style -o url=https://s3-{{aws_region}}.amazonaws.com | ||
=Debugging= | |||
$ | |||
= References = | = References = | ||
https://surajblog.medium.com/mount-aws-s3-bucket-on-amazon-ec2-9f18b48d4f04 | https://surajblog.medium.com/mount-aws-s3-bucket-on-amazon-ec2-9f18b48d4f04 | ||
Revision as of 17:19, 18 July 2024
Create an IAM role
- Open IAM
- Select Roles
- Create Role
- Select AWS service / EC2
- Search AmazonS3FullAccess
- Select it
- Add any other rights you need
- Remember only one IAM role can be bound to EC2
- Click Next
- Give it a name
- Click Create Role
Bind the Role to a EC2 Instance
- Open EC2
- Select the Instance
- Select Actions > Security > Change Security Groups.
- Connect the IAM role
Install Software
- Connect to the instance
- Run the commands
sudo apt-get update -y sudo snap install aws-cli --classic sudo apt-get install s3fs -y
- Create a mount point
sudo mkdir /mnt/s3-bucket
- Mount the S3 bucket
sudo s3fs flavell /mnt/s3-bucket -o iam_role=S3AccessForEC2 -o use_cache=/tmp -o allow_other -o uid=1001 -o mp_umask=002 -o multireq_max=5 -o use_path_request_style -o url=https://s3-Template:Aws region.amazonaws.com
Debugging
$
References
https://surajblog.medium.com/mount-aws-s3-bucket-on-amazon-ec2-9f18b48d4f04