amazon-s3 - s3fs 使用 $HOME/.aws 中的凭据和配置,而不是/passwd-s3fs 文件

标签 amazon-s3 fuse s3fs

我正在看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/

相关文章:

linux - posix_fallocate 以 4K 间隔一次写入 1 个字节,导致我对 NFS 实现的熔断非常慢

java - 通过 Java 进程执行的软件的虚拟文件系统环境

amazon-web-services - 使用动态文件在 EC2 上挂载 S3 (s3fs) - 持久公共(public)权限

ubuntu - 将大数据从 Droplet 同步到 Digital Ocean Space (S3)

php - 用于将本地目录与 Amazon S3 同步的守护进程(使用 Ubuntu Linux 和 PHP 的 AMI)

node.js - 如何在 aws lambda 处理程序中使用 multer-s3 作为中间件

python - 值错误: Filename must be a string while uploading file to s3 bucket

xcode - 在 XCode 项目中包含 OSXFUSE 框架

amazon-web-services - 使用 s3fs 实用程序 AWS 安装 S3 存储桶

amazon-s3 - 生成格式为 : s3. amazonaws.com/bucket.name 的预签名 URL