はじめに
ここではEC2からS3をマウントする手順を紹介します。
が、、これは本来のオブジェクトストレージの使い方とはずれた使い方なのであんまりおすすめしません。
設定手順
1.download
2.足りないものをインストールする(READMEに書いてあります)
gcc
libstdc++-devel
gcc-c++
fuse
fuse-devel
curl-devel
libxml2-devel
openssl-devel
3. configure,make,make install
4. s3fs --helpでヘルプが出てくることを確認する。
5. s3fsはroot以外では利用できないので他のユーザで利用できるように変更する。
sudo vi /etc/fuse.conf
user_allow_otherのコメントアウトを解除する。
6. ManagementConsole - ユーザ名 - SecurityConfidentialsを開く
7. AccessKeys - [Create new Access Keys]でAccessKeyとSecretAccessKeyを控えておく。
8. /etc/passwd-s3fsに下記の形式で記載し、Permissionを640へ。
AccessKey:SecretAccessKey
9. マウントする
sudo /usr/local/bin/s3fs [backet name] /var/www/html -o allow_other
10. 確認する。
[ec2-user@ip-172-31-11-90 html]$ ls -lrt /var/www/html
total 1
d--------- 1 root root 0 Jan 1 1970 test
---------- 1 root root 14 Oct 28 01:03 error.html
---------- 1 root root 10 Oct 28 01:53 hoge.html
気になる点/追加確認点
- curlでアクセスしてるだけでプロトコル的にはhttp。同一リージョン/AZであっても速くはない。
- 自動マウント設定