s3fsをインストールしてbucketをマウントする
s3fs インストール概要
必要なライブラリをインストールする
$ sudo yum install gcc-c++ fuse-devel openssl-devel libcurl-devel libxml2-devel
s3fsのソースを準備する
以下からcloneするかArchiveから直接落としてください。
https://github.com/s3fs-fuse/s3fs-fuse
インストールの流れ
- ./autogen.sh
- configure
- make
- sudo make install
configureはprefix=/オプションを使用できます。
aclocal: command not foundが出た時の対処法
$ sudo ./autogen.sh ./autogen.sh: line 23: aclocal: コマンドが見つかりません $ sudo yum info automake 利用可能なパッケージ 名前 : automake アーキテクチャー : noarch バージョン : 1.13.4 リリース : 3.15.amzn1 容量 : 718 k リポジトリー : amzn-main/latest 要約 : A GNU tool for automatically creating Makefiles URL : http://www.gnu.org/software/automake/ ライセンス : GPLv2+ and GFDL and Public Domain and MIT 説明 : Automake is a tool for automatically generating `Makefile.in' : files compliant with the GNU Coding Standards. : : You should install Automake if you are developing software and would : like to use its ability to automatically generate GNU standard : Makefiles.
マウント用のIAMユーザを作成する
- IAMコンソールにアクセス
- Create New Usersを選択
- 任意の名前でユーザを作成し、Access Key/Secret Access Keyを確認する
- 作成したユーザを選択し、Attach User Policyからポリシーを設定する
特定のbucketにのみアクセス可能なポリシーを作成する
arn:aws:s3:::mybucket/*
- アクセスするbucket内のファイルに対する権限を設定
arn:aws:s3:::mybucket
- bucketでlistをgetする時にアクセスする権限を設定
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:*" ], "Resource": [ "arn:aws:s3:::<mybucket>/*", "arn:aws:s3:::<mybucket>" ] } ] }
Credentialの設定
$ echo <Access Key>J<Secret Access Key> | sudo tee /etc/passwd-s3fs $ sudo chmod 640 /etc/passwd-s3fs
mount
$ s3fs my bucket /opt/mybucket
other user
$ ls /opt/mybucket ls: /opt/mybucketにアクセスできません: 許可がありません
$ fusermount -u /opt/mybucket $ s3fs my bucket /opt/mybucket -o allow_other
unmount
$ fusermount -u /opt/mybucket
シェアして頂けると嬉しいです。
参考になったという方がいれば是非お願いしますm(_ _ )m
モチベーション維持の観点で非常に励みになります。
Amazon Web Services クラウドデザインパターン実装ガイド
- 作者: 大澤文孝,玉川憲,片山暁雄,鈴木宏康
- 出版社/メーカー: 日経BP社
- 発売日: 2013/02/07
- メディア: 単行本
- 購入: 1人 クリック: 15回
- この商品を含むブログ (16件) を見る
よくわかるAmazonEC2/S3入門 ―AmazonWebServicesクラウド活用と実践 (Software Design plusシリーズ)
- 作者: 藤崎正範,深海寛信,五十嵐学,馬場俊彰
- 出版社/メーカー: 技術評論社
- 発売日: 2010/06/11
- メディア: 大型本
- 購入: 1人 クリック: 104回
- この商品を含むブログ (6件) を見る