【问题标题】:S3 + Cloudfront : files are allowed but folders are blockedS3 + Cloudfront:允许文件但阻止文件夹
【发布时间】:2020-06-03 09:53:33
【问题描述】:

我有一个问题,文件可以从我的存储桶中完全访问,但文件夹会引发访问被拒绝错误。有谁知道我该如何解决这个问题?我希望我的文件夹也可以访问。

这是我的存储桶政策:

{
    "Version": "2008-10-17",
    "Statement": [
        {
            "Sid": "DenyS3PublicObjectACL",
            "Effect": "Deny",
            "Principal": "*",
            "Action": "s3:PutObjectAcl",
            "Resource": [
                "arn:aws:s3:::xxxxx/*”,
                "arn:aws:s3:::xxxxx”
            ],
            "Condition": {
                "StringEqualsIgnoreCaseIfExists": {
                    "s3:x-amz-acl": [
                        "authenticated-read",
                        "public-read",
                        "public-read-write"
                    ]
                }
            }
        },
        {
            "Sid": "2",
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity XXXXXXXXXXX”
            },
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::xxxxx/*”
        }
    ]
}

【问题讨论】:

    标签: amazon-s3 amazon-cloudfront


    【解决方案1】:

    访问 URL 时,您不会从 Amazon S3 获得目录列表页面。 S3 不显示目录列表。

    参考:S3 allow public directory listing of parent folder?

    如果你想实现目录结构浏览器,请看这个插件。

    https://github.com/awslabs/aws-js-s3-explorer - 推荐

    https://github.com/rufuspollock/s3-bucket-listing

    【讨论】:

      猜你喜欢
      • 2017-08-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-15
      • 2014-11-22
      • 2016-10-24
      相关资源
      最近更新 更多