Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Sunday, 15 October 2017

Mount S3 Bucket using IAM Role on Ubuntu 16.04

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 : 

1















-- 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/*"]
    }
  ]
}

2



















Step: 2. Create a New Role using "Amazon EC2" Service Role Type :

-- Click on “Create new Role” and Select Role Type as Amazon EC2.

3
















-- Next select “s3access” policies to Attach.

4










-- Enter Role Name, Description as given below and click on “Create Role” button.

5



















-- The Attach Policy of the new Role should look like below:

6



















Step: 3. Attach IAM Role to the running Instance or Launching new Instance :

7
















-- Select Role name from drop-down box and click on “Apply” button.

8









9








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



Copyright © 2016 Kousik Chatterjee's Blog