amazon-s3fuses3fs

s3fs use credentials and config within $HOME/.aws as opposed to a /passwd-s3fs file


I'm looking at the readme of s3fs repo.

I wouldlike to mount an S3 dir locally using this tool. The readme says:

s3fs supports the standard AWS credentials file stored in ${HOME}/.aws/credentials. Alternatively, s3fs supports a custom passwd file.

The subsequent examples all seem to use the custom passwd file as opposed to the credentials in ~/.aws. I would like to use credentials in ~/.aws.

my .aws credentials and config file looks something like this:

~/.aws/credentials:

[work]
aws_access_key_id=123abc
aws_secret_access_key=mykeyhere
aws_s3_endpoint=s3.us-south.cloud-object-storage.appdomain.cloud

~/.aws/config:

[work]
region=us-south

I attempted to 'hello world' / run s3fs for the first time. Readme example provided:

Run s3fs with an existing bucket mybucket and directory /path/to/mountpoint:

s3fs mybucket /path/to/mountpoint -o passwd_file=${HOME}/.passwd-s3fs

I don't have a passwd file I want to use the credentials in .aws instead and don't know how to do that. Tried:

Just leaving off the -o passwd option and hoping it would default:

s3fs companyname-us-south-analytics-ml-models /home/doug/Documents/Projects/companyname/Projects/companynameS3
s3fs: could not determine how to establish security credentials.

I then tried adding the aws credentials file per the example:

s3fs companyname-us-south-analytics-ml-models /home/doug/Documents/Projects/companyname/Projects/companynameS3 -o passwd_file=${HOME}/.aws/credentials
s3fs: could not determine how to establish security credentials.

I then tried referencing 'work' per my aws config files (clutching at branches here)

s3fs companyname-us-south-analytics-ml-models /home/doug/Documents/Projects/companyname/Projects/companynameS3 -o work
    s3fs: could not determine how to establish security credentials.

I looked at man s3fs and found some info under authentication:

AUTHENTICATION
       The s3fs password file has this format (use this format if you have only one set of creden‐
       tials):
           accessKeyId:secretAccessKey

       If you have more than one set of credentials, this syntax is also recognized:
           bucketName:accessKeyId:secretAccessKey

       Password files can be stored in two locations:
            /etc/passwd-s3fs     [0640]
            $HOME/.passwd-s3fs   [0600]

I could not find anything on authenticating with the settings in ~/.aws.

How can I set up s3fs using the credentials in .aws?


Solution

  • If you want to use the "work" profile from ${HOME}/.aws/credentials then you need to add the -o profile=work option.