AWS S3 Bucket policy editor access denied

Amazon Web-ServicesAmazon S3Bucket

Amazon Web-Services Problem Overview


I am logged in with the root account trying to give public access to a bucket inline with the instructions for setting up a static s3 web site. However I get an access denied message when running the bucket policy.

There is no more detail on the message.

Error

Amazon Web-Services Solutions


Solution 1 - Amazon Web-Services

This could be due to recent changes in S3. To fix this issue, you need to assign Public Access to the bucket, follow the below steps:

  1. In the Permissions tab click on the Block Public Access settings.

  2. Click Edit to the right of these settings. enter image description here

  3. Make sure Block public access to buckets and objects granted through new public bucket or access point policies option is deselected. enter image description here

  4. Click Save.

  5. Go back to the Bucket Policy and try again.

Solution 2 - Amazon Web-Services

"Manage public bucket policies for this bucket" section need to be unchecked for to introduce "Allow" policies.

> But be cautious, unchecking these might enable you to introduce a > policy but that policy is a public policy making your bucket public.

Having these checked - You won't be able to introduce "Allow" policies that for this bucket.

You can however introduce "Deny" policies, with these options checked.

Solution 3 - Amazon Web-Services

Change the permissions to below works for me: enter image description here

Solution 4 - Amazon Web-Services

The accepted answer works even if related comments suggest it's not a good idea for security reasons. In fact it is in line with AWS instructions for static website hosting here

https://docs.aws.amazon.com/AmazonS3/latest/userguide/HostingWebsiteOnS3Setup.html

which answers the OP's question.

To summarise the steps (given in the linked page) to configure a static website on Amazon S3:

  1. Create a bucket
  2. Enable static website hosting
  3. Unblock all public access
  4. Add the bucket policy that makes your content publicly available (the yaml config you have in your post)
  5. Configure your index document (usually index.html)
  6. Configure any error/redirect/no-auth documents (for React this is usually also index.html)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionPhilbotView Question on Stackoverflow
Solution 1 - Amazon Web-ServicesmostafazhView Answer on Stackoverflow
Solution 2 - Amazon Web-ServicesbitemouthView Answer on Stackoverflow
Solution 3 - Amazon Web-ServicesWei ZhongView Answer on Stackoverflow
Solution 4 - Amazon Web-ServicesAndrew GoldieView Answer on Stackoverflow