amazon-web-servicesamazon-s3

Amazon S3 disable access of bucket root


I have a AWS S3 bucket use to share file (with anyone, public access). So my bucket is set as public. Normally to access at this file you need the url but when you GET my bucket root you got a xml with index all my file. So I want to disable this xml and make my file private without the exact url, do you have a solution ?


Solution

  • This bucket policy from the Bucket Policy Examples documentation page shows how to Grant Read-Only Permission to an Anonymous User:

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

    They will be able to access files, but will not be able to list, delete or upload objects.