amazon-web-servicesamazon-s3amazon-cloudfront

Access denied when navigate to folders


I upload my html code to S3 and enable the static website option. It works fine only for /index.html

If I navigate to an html file like products/index.html it works fine, but when I navigate to the folder like products/ it fails with AccessDenied.

What is the problem? It should recognise the index.html from inside the folder

{
    "Version": "2012-10-17",
    "Id": "__POLICYID__",
    "Statement": [
        {
            "Sid": "__SSID__",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::__MYDOMAIN__/*"
        }
    ]
}

Solution

  • Finally this the solution is a lambda@edge thath replace any path finished with / for path/index.html

    https://aws.amazon.com/blogs/compute/implementing-default-directory-indexes-in-amazon-s3-backed-amazon-cloudfront-origins-using-lambdaedge/