LoginSignup
3
2

More than 5 years have passed since last update.

aws ubuntu s3マウント

Posted at

awsのEC2インスタンスにs3をマウント

環境

  • ubuntu 14.04
  • s3fsを利用
  • IAM Userで構築

参考:

http://qiita.com/monry/items/fa3bebd69e04a08ae12f
http://qiita.com/Yuki_BB3/items/9f5eb233b152be1c4bc9

IAM UserでIAM作成

IAM Roleでの作成方法もあるが、
IAM Userの場合はEC2インスタンスを再立ち上げする必要がない。
今回はIAM Userを採用。

IAM作成は
http://qiita.com/monry/items/fa3bebd69e04a08ae12f
を参考。

Access Key IDおよびSecret Access Keyを用意しておく。

s3fsインストール

s3fs git:
https://github.com/s3fs-fuse/s3fs-fuse

ubuntuなのでapt-getで必要なものをインストール

$ sudo apt-get install automake autotools-dev g++ git libcurl4-gnutls-dev libfuse-dev libssl-dev libxml2-dev make pkg-config

s3fsをインストール

$ git clone https://github.com/s3fs-fuse/s3fs-fuse.git
$ cd s3fs-fuse
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install

s3fsが/usr/local/bin下におかれる。
/usr/bin下に置きたい場合は上記コマンド実行時に--prefix=/usrオプションを./configureにつける。

$ ./configure --prefix=/usr

マウントポイント作成

$ sudo mkdir /mnt/s3

IAM access keyを保存

$ echo <Access Key ID>:<Secret Access Key> | sudo tee -a /etc/passwd-s3fs
$ sudo chmod 640 /etc/passwd-s3fs

マウント

マウント時のownerのuid, gidを確認。

$ id <User Name>

マウント

$ sudo s3fs <Bucket Name> <Mount Point> -o rw,allow_other,uid=<UID>,gid=<GID>,default_acl=public-read
3
2
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
3
2