"Principle" error setting S3 Bucket Policy - Printable Version +- AWS Discussion Forum (https://letstalkaws.com) +-- Forum: Q & A (https://letstalkaws.com/forum-10.html) +--- Forum: System Administration Help (https://letstalkaws.com/forum-25.html) +--- Thread: "Principle" error setting S3 Bucket Policy (/thread-72.html) |
"Principle" error setting S3 Bucket Policy - ConImp - 11-07-2022 Greetings! This is my first post on this forum. I'm relatively new to AWS and am setting up an S3 Bucket for a static website and when trying to set an S3 Bucket Policy generated from the policy generator, I am getting an error: Unknown Error An unexpected error occurred. *API Response Invalid principle in policy Here is the JSON script I am using from out of the policy generator. Note: I pasted into Notepad and recopied first for formatting purposes: { "Id": "Policy1657559771298", "Version": "2012-10-17", "Statement": [ { "Sid": "Stmt1657559769311", "Action": "s3:*", "Effect": "Allow", "Resource": "arn:aws3:::continuous-improvement.org", "Principal": { "AWS": [ "admin-w" ] } } ] } Please let me know if you have any ideas... RE: "Principle" error setting S3 Bucket Policy - fzs - 14-07-2022 (11-07-2022, 05:38 PM)ConImp Wrote: *API Response This is happening most likely due to the incorrect syntax for the principal element. It has to be listed with a proper ARN format. You can find this in the IAM details for the user you are attempting to give access to. Assuming you have created this user already. Example below: Code: "Principal": { More details on how to properly format the Principal element can be found here: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_principal.html RE: "Principle" error setting S3 Bucket Policy - ConImp - 16-07-2022 I was able to figure this out. The sample JSON scripts don't really get you all the way there, but here's what I used. { "Id": "Policy1658008936181", "Version": "2012-10-17", "Statement": [ { "Sid": "Stmt1658008933263", "Action": "s3:*", "Effect": "Allow", "Resource": "arn:aws3::3bucketname", "Principal": { "AWS": [ "arn:aws:iam::accountnumber:user/admin-w" ] } } ] } I built the statement using the Policy Generator, but it doesn't build it all the way, so you have to go back and add the "arn.aws.iam::accountnumber:user/user-name" line. Not sure why this is, but now that I know, I wanted to pass this along. This may be a noob pitfall, but hopefully this will help someone else at some point. |