Danneniko
Danneniko

Reputation: 33

S3 + Cloudfront : files are allowed but folders are blocked

I have a problem where files are perfectly accessible from my bucket, but folders throw an access denied error. Does anyone know how I can solve this? I want my folders to be accessible too.

Here is my bucket policy:

{
    "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/*”
        }
    ]
}

Upvotes: 1

Views: 916

Answers (1)

Avinash Dalvi
Avinash Dalvi

Reputation: 9311

You won't get a directory listing page out of Amazon S3 when accessing the URL. S3 doesn't show directory listing.

Reference : S3 allow public directory listing of parent folder?

If you want to implement directory structure explorer see this plugin.

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

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

Upvotes: 1

Related Questions