You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Minio与aws-cli配置多实例配置文件及连接异常排查

解决AWS CLI连接多Minio实例时无需--endpoint-url的配置问题

问题重现

携带--endpoint-url参数时,两个Minio实例均可正常访问:

aws --profile project01 --endpoint-url http://localhost:9000 s3 ls s3://my-bucket01/

返回结果:

PRE data/
2022-10-11 16:21:09      71412 yt.csv
aws --profile project02 --endpoint-url http://localhost:9001 s3 ls s3://my-bucket02/

返回结果:

PRE data/
2022-10-11 16:22:09      20989 xt.csv

移除--endpoint-url参数后,执行以下命令均报错:

aws --profile project01 s3 ls s3://my-bucket01/
aws --profile project02 s3 ls s3://my-bucket02/

错误信息:

An error occurred (InvalidAccessKeyId) when calling the ListObjectsV2 operation: The AWS Access Key Id you provided does not exist in our records.

当前.aws/credentials文件内容:

[project01]
aws_access_key_id = minioadmin
aws_secret_access_key = minioadmin
[project02]
aws_access_key_id = minioadmin
aws_secret_access_key = minioadmin

当前.aws/config文件内容:

[plugins]
endpoint = awscli_plugin_endpoint

[project01]
s3 =
     endpoint_url = http://localhost:9000
[project02]
s3 =
     endpoint_url = http://localhost:9001

问题原因

  1. Profile格式错误:AWS CLI的config文件中,自定义profile必须以[profile <名称>]格式声明,直接写[project01]会被识别为默认配置的一部分,而非独立的自定义profile。
  2. 缺少Minio必需配置项:Minio要求指定签名版本和区域,缺失会导致身份验证流程异常。
  3. Endpoint插件非必需且可能存在兼容问题:原生AWS CLI已支持通过config直接配置endpoint,无需额外插件。

解决方案

1. 修正.aws/config文件

调整profile格式,并补充Minio必需的配置项:

[profile project01]
s3 =
    endpoint_url = http://localhost:9000
    signature_version = s3v4
    region = us-east-1
[profile project02]
s3 =
    endpoint_url = http://localhost:9001
    signature_version = s3v4
    region = us-east-1

若不需要awscli_plugin_endpoint插件,可直接删除[plugins]段落。

2. 验证配置有效性

执行以下命令测试,无需再携带--endpoint-url参数:

aws --profile project01 s3 ls s3://my-bucket01/
aws --profile project02 s3 ls s3://my-bucket02/

此时应能正常返回Bucket内的文件列表。

3. (可选)确认插件状态

若坚持使用awscli_plugin_endpoint,先确保插件已正确安装:

pip install awscli-plugin-endpoint

保留config中的插件声明,但仍需修正profile格式并补充签名版本、区域配置。

内容的提问来源于stack exchange,提问作者Adil Blanco

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.16 12:45:47