H3XED
Web Development   Browse Topics

How to Make All Objects in Amazon S3 Bucket Public by Default

Posted Aug 31, 2016 by Nick Vogt
If you want to make all items in your Amazon S3 bucket viewable by anyone that has the URL, you need to add a Bucket Policy that gives "Allow" permission to all users for all resources in your bucket.


Bucket Properties


Open the Properties for the bucket you want to make public.

Step 1
Click "Permissions":

Amazon S3 Bucket Policy Public Read

Step 2
Click "Edit bucket policy":

Amazon S3 Bucket Policy Public Read

Step 3
Here you enter the bucket policy by copying and pasting it in (or writing it directly in the text box). Amazon has an "AWS Policy Generator" that you can use to generate a policy, but it can be pretty confusing to use at first. Here is a sample policy to make anything in the bucket viewable publicly, without needing to individually mark items as public. Be sure to change test.h3xed.com to the actual name of your bucket.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "PublicReadGetObject",
      "Action": "s3:GetObject",
      "Effect": "Allow",
      "Resource": "arn:aws:s3:::test.h3xed.com/*",
      "Principal": "*"
    }
  ]
}

Amazon S3 Bucket Policy Public Read

Note: Users must still have the exact URL to resources. They cannot view the "index" of your bucket or list of contents.

Don't forget to hit "Save"!
Share This Post
Facebook Twitter

Comments


Share This Post
Facebook Twitter
H3XED © Nick Vogt   RSS   Privacy Policy   Facebook   Twitter   Google+