Paul Taylor
Paul Taylor

Reputation: 13110

Can I configure S3 Bucket so that all files uploaded to it so all pages are visible to everyone by default

Can I configure S3 Bucket so that all files uploaded to it so all pages are visible to everyone by default ?

When I converted an existing bucket to a website I found that none of the pages were viewable unless I gave Everyone permission to each file which is a pain, is there a way to default to giving full read permissions on all files.

Upvotes: 1

Views: 66

Answers (1)

Neal Magee
Neal Magee

Reputation: 1701

Absolutely you can. This is a common use-case for sites that store some (or all) of their static media in S3/CloudFront. Just set up an S3 bucket policy at the root level of the bucket.

Here is a sample policy that allows * (anyone) to GetObject from the bucket you define in your examplebucket:

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

Upvotes: 1

Related Questions