【问题标题】:AWS S3 CLI ACL public-read gives me 403 with sync commandAWS S3 CLI ACL public-read 给我 403 和同步命令
【发布时间】:2015-01-21 09:40:20
【问题描述】:

我无法弄清楚为什么在查看页面时会收到 403 权限被拒绝错误。我正在使用带有以下命令的 AWS CLI:

aws s3 sync [source] [s3 destination] --acl public-read --recursive --delete --profile [my_profile]

在 IAM 上,我的政策如下:

{
  "Version": "2012-10-17",
  "Statement": [
{
  "Effect": "Allow",
  "Action": ["s3:ListBucket"],
  "Resource": ["bucket_location"]
},
{
  "Effect": "Allow",
    "Action": [
      "s3:PutObject",
      "s3:PutObjectAcl",
      "s3:GetObject",
      "s3:DeleteObject"
    ],
      "Resource": ["bucket_location"]
    }
  ]
}

路径是正确的,因为它确实上传了文件,但看起来它忽略了 --acl public-read 选项。当我使用 cp 命令时,它看起来运行正常。我只是喜欢使用同步来使用 --delete 选项进行清理。有什么想法吗?

【问题讨论】:

    标签: amazon-web-services amazon-s3 acl aws-cli


    【解决方案1】:

    好的,由于@sebsto 建议使用策略模拟器,我发现了以下内容:我需要 PutObjectAclPutBucketAcl。现在同步工作。

    【讨论】:

      【解决方案2】:

      在您的第二个政策声明(带有PutObject,... 的那个)中,请确保在您的对象名称中包含一个通配符:

      "Resources" : [ "bucket_name/*" ]
      

      您知道您可以使用在线Policy Simulator 工具测试您的策略吗?

      【讨论】:

        猜你喜欢
        • 2021-07-11
        • 1970-01-01
        • 2017-06-05
        • 2021-04-20
        • 1970-01-01
        • 2015-11-07
        • 2015-12-12
        • 2019-08-31
        相关资源
        最近更新 更多