我正在看the readme of s3fs repo .
我想使用此工具在本地安装 S3 目录。自述文件说:
s3fs supports the standard AWS credentials file stored in ${HOME}/.aws/credentials. Alternatively, s3fs supports a custom passwd file.
后续示例似乎都使用自定义 passwd 文件,而不是 ~/.aws
中的凭证。我想在 ~/.aws
中使用凭证。
我的 .aws 凭证和配置文件如下所示:
~/.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
我第一次尝试“hello world”/运行 s3fs。提供的自述文件示例:
Run s3fs with an existing bucket mybucket and directory /path/to/mountpoint:
s3fs mybucket /path/to/mountpoint -o passwd_file=${HOME}/.passwd-s3fs
我没有 passwd 文件,我想使用 .aws 中的凭证,但不知道该怎么做。尝试过:
只需省略 -o passwd
选项并希望它会默认:
s3fs companyname-us-south-analytics-ml-models /home/doug/Documents/Projects/companyname/Projects/companynameS3
s3fs: could not determine how to establish security credentials.
然后我尝试根据示例添加 aws 凭证文件:
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.
然后,我尝试根据我的 aws 配置文件引用“工作”(捕获此处的分支)
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.
我查看了 man s3fs
并在身份验证下找到了一些信息:
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]
我找不到任何有关使用 ~/.aws
中的设置进行身份验证的内容。
如何使用 .aws 中的凭据设置 s3fs?
最佳答案
如果您想使用 ${HOME}/.aws/credentials
中的“工作”配置文件,则需要添加 -o profile=work
选项。
关于amazon-s3 - s3fs 使用 $HOME/.aws 中的凭据和配置,而不是/passwd-s3fs 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69928235/