Archive
This post is archived and may contain outdated information. It has been set to 'noindex' and should stop showing up in search results.
How to Make All Objects in Amazon S3 Bucket Public by Default
Aug 31, 2016Web DevelopmentComments (6)
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"!
Comments (6)
Add a Comment


Please review the commenting policy prior to commenting.
Chuck Norris   Dec 14, 2022
Still works great. Thank you!
Rubnawaz   Aug 13, 2020
Thank you very much, it is very use fill, I aws wondering in internet to find this solution. Great Job. Very Good.
Jade   Sep 16, 2018
I've set this up, however when people visit the bucket root they get a whole list of everything in the bucket. Is there a way to redirect them, or block only the root folder?
Doug   May 07, 2018
Side note: Don't change the: "Version": "2012-10-17" It's required to be that date per Amazon. Changing it to anything else will throw an error: "The policy must contain a valid version string" More info: https://stackoverflow.com/questions/41291006/aws-policy-must-contain-valid-version-string
jackson   Feb 16, 2018
Thanks a lot!
zerokol   Oct 23, 2017
Amazing! It works!