文章目录
-
- 描述
- 原因
- 解决
描述
使用 aws cli命令行下载文件时出错
# aws s3 cp --recursive s3://xxxx.xxx.com xxx.xxx.com
fatal error: An error occurred (IllegalLocationConstraintException) when calling the ListObjectsV2 operation: The unspecified location constraint is incompatible for the region specific endpoint this request was sent to
原因
aws 账号的config与credentials 配置不一致, 导致无法访问s3上的bucket
prod2 != prod
# ~/.aws/credentials
[default]
aws_access_key_id = xxx
aws_secret_access_key = xxx
[prod2]
aws_access_key_id = xxx
aws_secret_access_key = xxx
[default]
region=ap-east-1
output=json
[prod]
region=ap-east-1
output=text
解决
将配置修改成一致重新执行命令就可以了