aws cli 签名版本 4

aws cli signature version 4

我想将我的所有数据从帐户 ABucket1 移动到帐户 BBucket2

为此:

  1. 我为 Windows 下载了 AWS CLI

  2. 使用命令 aws configure 输入 IAM 凭据(这些凭据来自帐户 B

  3. 运行 同步存储桶的命令:aws s3 sync s3://Bucket1 s3://Bucket2

    我收到以下错误:

fatal error: An error occured (InvalidRequest) when calling the ListObject operation: You are attempting to operate on a bucket in a region that requires Signature Version 4. You can fix this issue by explicitly providing the correct region location using the --region argument, the AWS_DEFAULT_REGION environment variable, or the region variable in the AWS CLI configuration file. You can get the bucket's location by running "aws s3api get-bucket-location --bucket BUCKET".

如何解决这个错误?

aws --version
aws-cli/1.11.61 Python/2.7.9 windows/8 botocore/1.5.24

我的 S3 url 就像:https://console.aws.amazon.com/s3/home?region=us-east-1 所以我以为 us-east-1 是我的地区,但实际上不是!

我使用 AWS 命令​​查找 Bucket2 区域,它告诉我一个不同的区域。

然后我使用了这个命令aws s3 sync s3://Bucket1 s3://Bucket2 --region Asia Pacific (Mumbai),一切正常!

寻找桶的正确区域(见附图)。
通过指定正确的区域尝试以下命令:

aws s3 ls --region us-west-2

S3 是全球性的 - 不要让它误导您。