0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

S3fs インストール&設定手順 (IAMRole利用)

Last updated at Posted at 2015-06-22

S3fs インストール&設定手順 (IAMRole利用)

1.IAMRole作成

bucket名:mybucket
ディレクトリ名:mypath

{
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:ListBucket",
                "s3:ListBucketVersions"
            ],
            "Resource": "arn:aws:s3:::mybucket",
            "Condition": {
                "StringLike": {
                    "s3:prefix": "mypath/*"
                }
            }
        },
        {
            "Effect": "Allow",
            "Action": "s3:*",
            "Resource": [
                "arn:aws:s3:::mybucket/mypath/*"
            ]
        }
    ]
}

2.EC2ローンチ

上記IAMRoleを指定

3.S3fsのインストール

yum -y install git automake gcc-c++ fuse fuse-devel libcurl-devel libxml2-devel openssl-devel
cd /usr/local/src/
wget https://github.com/s3fs-fuse/s3fs-fuse/archive/v1.78.tar.gz
tar xzvf v1.78.tar.gz
ls -l
cd s3fs-fuse-1.78/
./autogen.sh
./configure prefix=/usr
make
make install

4.マウント設定

rc.local

IAMROLE=`curl --silent  http://169.254.169.254/latest/meta-data/iam/security-credentials/`
/usr/bin/s3fs mybucket:/mypath /mnt -o iam_role=${IAMROLE},rw,allow_other

※/etc/fstabでマウントすると、IAMRole取得のタイミングで失敗の可能性がある。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?