LoginSignup
8

More than 5 years have passed since last update.

EC2にgoofysを使ってS3をマウントしたメモ

Last updated at Posted at 2018-06-26

S3をEC2にマウントした時に少し苦労したので書いておく。

このブログを参考にgoofysを入れる。

Goとfuseをインストール

$ sudo yum install golang fuse -y

goofysをインストール

sudo wget https://github.com/kahing/goofys/releases/download/v0.0.5/goofys -P /usr/local/bin/

AWSと結びつけるためにAWSCLIの設定をする。

AWSCLI の設定については公式を参照

aws configure

マウントポイントの作成

フォルダを作るだけです。

mkdir s3

S3をマウントする

下記コマンドを実行

 goofys S3バケット名  マウントポイント

このあとbin/goofysを見る権限がないって怒られて、sudoをつけるけれども goofys なんていうコマンドはないと怒られる。

原因はこのコマンドを打っていないから

export GOPATH=$HOME/go

そりゃそうですわ。

このあと実行コマンドを直し実行

$GOPATH/bin/goofys s3バケット名 マウントポイント

でもだめ。
main.FATAL Unable to mount file system, see syslog for details
ただsyslogを見ろとエラーが出るのでまだ助かる。 /var/log/messages

syslogを見ると以下の通り

/home/ec2-user/go/bin/goofys[2856]: s3.INFO Switching from region 'us-east-1' to 'ap-northeast-1'
/home/ec2-user/go/bin/goofys[2856]: s3.ERROR code=NoCredentialProviders msg=no valid providers in chain. Deprecated.#012#011For verbose messaging see aws.Config.CredentialsChainVerboseErrors, err=<nil>#012
/home/ec2-user/go/bin/goofys[2856]: s3.ERROR code=NoCredentialProviders msg=no valid providers in chain. Deprecated.#012#011For verbose messaging see aws.Config.CredentialsChainVerboseErrors, err=<nil>#012
/home/ec2-user/go/bin/goofys[2856]: main.FATAL Mounting file system: Mount: initialization failed
/home/ec2-user/go/bin/goofys[2856]: main.ERROR Unable to access 's3バケット名': NoCredentialProviders: no valid providers in chain. Deprecated.#012#011For verbose messaging see aws.Config.CredentialsChainVerboseErrors

awsのconfigureが読み取れなかったみたいです。
コマンド ls ~/.aws でconfigureがある場所を探すと
root配下にありました。

毎回sudoコマンド打つのも嫌になったので
sudo su -
でrootユーザーに変更。

そうして上記マウントのコマンド打つと
$GOPATH/bin/goofys s3バケット名 マウントポイント

無事マウントしました。

参考にしたサイト

EC2+goofysでS3バケットをマウントしたい

goofysを使ってAmazon LinuxにS3をマウントする。

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
8