3

I am trying to mount a S3 bucket on an AWS EC2 instance following this instruction. I was able to install the dependencies via yum, followed by cloning the git repository, and then making and installing the s3fs tool.

Furthermore, I ensured my AWSACCESSKEYID and AWSSECRETACCESSKEY values were in several locations (because I could not get the tool to work and searching for an answer suggest placing the file in different locations).

  • ~/.passwd-s3fs
  • /etc/.passwd-s3fs
  • ~/.bash_profile

For the .passwd-s3fs I have set the permissions as follows.

chmod 600 ~/.passwd-s3fs
chmod 640 /etc/.passwd-s3fs

Additionally, the .passwd-s3fs files have the content as suggested in this format: AWSACCESSKEYID:AWSSECRETACCESSKEY.

I have also logged out and in just to make sure the changes take effect. When I execute this command /usr/bin/s3fs bucketname /mnt, I get the following response.

s3fs: MOUNTPOINT: /mnt permission denied.

When I run the same command with sudo, e.g. sudo /usr/bin/s3fs mybucket /mnt, I get the following message.

s3fs: could not determine how to establish security credentials.

I am using s3fs v1.84 on the following AMI ami-0ff8a91507f77f867 (Amazon Linux AMI 2018.03.0.20180811 x86_64 HVM GP2). From the AWS Console for S3, my bucket's name is NOT mybucket but something just as simple (I am wondering if there's anything special I have to do with naming).

Additionally, my AWS access and secret key pair is generated from the IAM web interface and placed into the admin group (having AdministratorAccess policy) defined below.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "*",
      "Resource": "*"
    }
  ]
}

Any ideas on what's going on? Did I miss a step?

2 Answers 2

4

After tinkering a bit, I found the following helps.

/usr/bin/s3fs mybucket /mnt -o passwd_file=.passwd-s3fs -o allow_other

Note that I specify the .passwd-s3fs file's location. And also note that I allow others to view the mount. Additionally, I had to modify /etc/fuse.conf to enable user_allow_other.

# mount_max = 1000
user_allow_other

To test, I typed in touch /mnt/README.md and then observed the file in my S3 bucket (web UI).

I am a little disappointed that this problem is not better documented. I would have expected the default home location or /etc to be where the .passwd-s3fs file would be looked by the tool, but that's not the case. Additionally, sudo (as suggested by a link I did not bookmark) forces the tool to look in ~/home/root, which does not exists.

1
  • 2
    You should add a subdirectory to /mnt. Something like /mnt/my-bucket. And use that as mountpoint. Cause /mnt is sometimes used to mount other devices too.
    – Soerendip
    Aug 11, 2021 at 20:39
0

For me it was mismatch in IAM profile while mounting and IAM profile of ec2 server.

EC2 was launched with role2 and I was mouting with

/usr/local/bin/s3fs -o allow_other mybucket /mnt/s3fs/mybucketfolder -o iam_role='role1'

which dit not through any error but did not mounted.

PS

I do not have any access keys or s3 password file on ec2 server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.