0

我一直在尝试按照以下说明将存储桶内容从 S3 复制到另一个存储桶:

http://blog.vizuri.com/how-to-copy/move-objects-from-one-s3-bucket-to-another-between-aws-accounts

我有一个目标存储桶(我想在其中复制内容)和一个源存储桶。

在目标端,我使用以下用户策略创建了一个新用户:

{
  "Version": "2012-10-17",
  "Statement": [
     {
         "Effect":"Allow",
         "Action":[
            "s3:ListAllMyBuckets"
         ],
         "Resource":"arn:aws:s3:::*"
      },
      {
         "Effect":"Allow",
         "Action":[

              "s3:GetObject"             
              ],
         "Resource":[

              "arn:aws:s3:::to-destination/*"
              ]
      },
    {
      "Effect": "Allow",
      "Action": [
            "s3:ListBucket",
            "s3:GetBucketLocation"
            ],
      "Resource": [
              "arn:aws:s3:::to-destination"

            ]
    }

  ]
}

并创建了目标存储桶。

在源端,我对存储桶有以下策略:

{
    "Version": "2008-10-17",
    "Id": "Policy****",
    "Statement": [
        {
            "Sid": "Stmt****",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "*****"
        }
    ]
}

当我尝试使用 aws cli 将源的内容复制到目标时:

aws s3 sync s3://source-bucket-name  s3://destination-bucket-name

我总是收到这个错误

An error occurred (AccessDenied) when calling the ListObjects operation: Access Denied
Completed 1 part(s) with ... file(s) remaining

我究竟做错了什么 ?我的政策起草方式有问题吗?

更新

我还尝试关注这篇建议更新源存储桶策略和目标存储桶策略的帖子:

https://serverfault.com/questions/556077/what-is-causing-access-denied-when-using-the-aws-cli-to-download-from-amazon-s3

但我仍然在命令行上遇到同样的错误

4

2 回答 2

0

您是否使用 $ aws configure 从 CLI 配置了您的帐户?您可以使用策略生成器来验证您上面提到的自定义策略是否正确构建。

于 2016-10-25T12:24:41.737 回答
0

由于 SSL 验证导致的此错误。使用此代码将对象传输到新存储桶,无需验证 SSL。

aws s3 sync s3://source-bucket-name  s3://destination-bucket-name --no-verify-ssl

使用--no-verify-ssl

于 2019-06-19T12:42:46.720 回答