【问题标题】:Can't copy S3 source bucket content to a new destination S3 bucket无法将 S3 源存储桶内容复制到新的目标 S3 存储桶
【发布时间】:2016-10-25 11:29:44
【问题描述】:

我一直在尝试按照以下说明将存储桶内容从 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

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

【问题讨论】:

  • 你试过使用aws cp --recursive吗?它似乎更适合您的用例(复制而不是同步)
  • 我在目标端没有看到s3:PutObject

标签: amazon-s3 bucket policies


【解决方案1】:

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

【讨论】:

  • 我们最终使用了cyberduck
【解决方案2】:

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

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

使用 --no-verify-ssl

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-11-23
    • 1970-01-01
    • 2022-06-12
    • 2022-01-07
    • 2019-08-07
    • 2018-06-18
    • 2020-11-29
    • 2018-08-31
    相关资源
    最近更新 更多