Mount S3 Bucket using IAM Role on Ubuntu 16.04
Q. What Is Amazon S3?
-- Amazon Simple Storage Service is storage for the Internet. It is designed to make web-scale computing easier for developers. Amazon S3 has a simple web services interface that you can use to store and retrieve any amount of data, at any time, from anywhere on the web.
Step: 1. Create a new Policy to Access the target S3 Bucket :
-- Enter Policy Name, Description and the Policy Document as given below :
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetBucketLocation",
"s3:ListAllMyBuckets"
],
"Resource": "arn:aws:s3:::*"
},
{
"Effect": "Allow",
"Action": ["s3:ListBucket"],
"Resource": ["arn:aws:s3:::bucket-name"]
},
{
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:DeleteObject"
],
"Resource": ["arn:aws:s3:::bucket-name/*"]
}
]
}
Step: 2. Create a New Role using "Amazon EC2" Service Role Type :
-- Click on “Create new Role” and Select Role Type as Amazon EC2.
-- Next select “s3access” policies to Attach.
-- Enter Role Name, Description as given below and click on “Create Role” button.
-- The Attach Policy of the new Role should look like below:
Step: 3. Attach IAM Role to the running Instance or Launching new Instance :
-- Select Role name from drop-down box and click on “Apply” button.
Step: 4. Mount S3 Bucket to an Instance :
-- Login to instance using console and follow the steps below :
# apt-get update -y
# apt-get install build-essential libfuse-dev libcurl4-openssl-dev libxml2-dev \
mime-support automake libtool git
# cd /tmp
# git clone https://github.com/s3fs-fuse/s3fs-fuse.git
# cd s3fs-fuse/
# ./autogen.sh
# ./configure
# make
# make install
# mkdir /s3backups
# chmod 755 /s3backups
-- Now Mount the S3 Bucket using IAM Role :
# s3fs -o iam_role="EC2RoleForS3Access" bucket-name /s3backups
# df -Th
[OUTPUT]
Filesystem Type Size Used Avail Use% Mounted on
s3fs fuse.s3fs 256T 0 256T 0% /s3backups
Thanks For Visiting on My Blog, For More Tutorials Keep Visiting My Blog
great thanks!
ReplyDeletesuperb!! thanks
ReplyDeleteIt’s really interesting content and nice post AWS online Course
ReplyDeleteyou must Install libssl-dev, otherwise you will get "libcryto" not found error
ReplyDeletesudo apt-get install libssl-dev
exact error is "No package 'libcrypto' found". Run below to resolve this issue.
ReplyDeletesudo apt-get install libssl-dev
You should see how my pal Wesley Virgin's story starts in this SHOCKING AND CONTROVERSIAL video.
ReplyDeleteAs a matter of fact, Wesley was in the army-and soon after leaving-he discovered hidden, "self mind control" secrets that the CIA and others used to get anything they want.
These are the same secrets tons of famous people (notably those who "come out of nowhere") and top business people used to become wealthy and successful.
You probably know that you utilize only 10% of your brain.
That's mostly because the majority of your brain's power is UNCONSCIOUS.
Maybe that expression has even taken place INSIDE your own brain... as it did in my good friend Wesley Virgin's brain about seven years ago, while driving an unregistered, garbage bucket of a car with a suspended driver's license and with $3.20 in his bank account.
"I'm very fed up with going through life payroll to payroll! When will I finally succeed?"
You've been a part of those those types of thoughts, ain't it right?
Your own success story is waiting to start. All you have to do is in YOURSELF.
Learn How To Become A MILLIONAIRE Fast