天天看點

aws s3 bucket 下載下傳檔案失敗

文章目錄

    • 描述
    • 原因
    • 解決

描述

使用 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
           

解決

将配置修改成一緻重新執行指令就可以了

繼續閱讀