I have an s3 bucket in which the objects within it need to be made public, right now anytime I upload a new file I have to click on it and then click "make public using acl" I wonder if there is a way to set it so any new file uploaded to my bucket is public by default. I tried giving the bucket itself public permission but I still have to make the individual objects public too.
2 Answers
For details see the post How to Make All Objects in Amazon S3 Bucket Public by Default.
To resume:
Open the Properties for the bucket you want to make public
Click "Permissions"
Click "Edit bucket policy"
Copy and paste the following text:
{ "Version": "2012-10-17", "Statement": [ { "Sid": "PublicReadGetObject", "Action": "s3:GetObject", "Effect": "Allow", "Resource": "arn:aws:s3:::test.h3xed.com/*", "Principal": "*" } ] }
Change
test.h3xed.com
to the actual name of your bucketClick "Save".
Note: Users must still use the exact URL to your resources. They cannot view the "index" of your bucket or list its contents.
-
I get "You don't have permissions to edit bucket policy", I tried as root user and as IAM user with with full access.– fredCommented Apr 14, 2022 at 18:59
@fred, must probably your problem was solved by now. Related to your comment 'I get "You don't have permissions to edit bucket policy", I tried as root user and as IAM user with with full access.', it could be because the Block Public Access to your bucket is enabled (https://docs.aws.amazon.com/AmazonS3/latest/userguide/configuring-block-public-access-bucket.html). This can be set at bucket level or account level (https://docs.aws.amazon.com/AmazonS3/latest/userguide/configuring-block-public-access-account.html). Block public access bucket AWS S3 console
-
1Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.– Community BotCommented Feb 15 at 10:55