The following warnings occurred:
Warning [2] Undefined array key "extra" - Line: 100 - File: inc/plugins/google_seo/url.php PHP 8.3.36 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/inc/plugins/google_seo/url.php 100 errorHandler->error_callback
/inc/plugins/google_seo.php 317 require_once
/inc/class_plugins.php 38 require_once
/inc/init.php 263 pluginSystem->load
/global.php 20 require_once
/printthread.php 16 require_once
Warning [2] Undefined variable $location - Line: 1250 - File: inc/plugins/google_seo/url.php PHP 8.3.36 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/inc/plugins/google_seo/url.php 1250 errorHandler->error_callback
/inc/plugins/google_seo/url.php 174 google_seo_url_hook
/inc/plugins/google_seo.php 317 require_once
/inc/class_plugins.php 38 require_once
/inc/init.php 263 pluginSystem->load
/global.php 20 require_once
/printthread.php 16 require_once
Warning [2] Undefined array key "oa_social_login_custom_caption" - Line: 356 - File: inc/plugins/oa_social_login.php PHP 8.3.36 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/inc/plugins/oa_social_login.php 356 errorHandler->error_callback
/inc/plugins/oa_social_login.php 197 oa_social_login_load_plugin
/inc/class_plugins.php 142 oa_social_login_load_plugin_hook_any
/global.php 498 pluginSystem->run_hooks
/printthread.php 16 require_once
Warning [2] Undefined variable $unreadreports - Line: 44 - File: global.php(961) : eval()'d code PHP 8.3.36 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/global.php(961) : eval()'d code 44 errorHandler->error_callback
/global.php 961 eval
/printthread.php 16 require_once
Warning [2] Undefined array key "button_www" - Line: 273 - File: inc/plugins/google_seo/meta.php PHP 8.3.36 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/inc/plugins/google_seo/meta.php 273 errorHandler->error_callback
/inc/plugins/google_seo/meta.php 252 google_seo_meta_posts
/inc/plugins/google_seo/meta.php 288 google_seo_meta_thread
/inc/class_plugins.php 142 google_seo_meta_printthread
/printthread.php 210 pluginSystem->run_hooks
Warning [2] Undefined array key "button_www" - Line: 273 - File: inc/plugins/google_seo/meta.php PHP 8.3.36 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/inc/plugins/google_seo/meta.php 273 errorHandler->error_callback
/inc/plugins/google_seo/meta.php 301 google_seo_meta_posts
/inc/class_plugins.php 142 google_seo_meta_printthread_post
/printthread.php 210 pluginSystem->run_hooks
Warning [2] Undefined array key "button_www" - Line: 273 - File: inc/plugins/google_seo/meta.php PHP 8.3.36 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/inc/plugins/google_seo/meta.php 273 errorHandler->error_callback
/inc/plugins/google_seo/meta.php 301 google_seo_meta_posts
/inc/class_plugins.php 142 google_seo_meta_printthread_post
/printthread.php 210 pluginSystem->run_hooks



AWS Discussion Forum
"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:awsConfused3:::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
Invalid principle in policy


      "Principal": {
        "AWS": [
          "admin-w"
        ]
      }


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": {
    "AWS": "arn:aws:iam::111111111111:user/user-name1"
  }

or for multiple usernames:


[font=Consolas, 'Andale Mono WT', 'Andale Mono', 'Lucida Console', 'Lucida Sans Typewriter', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Liberation Mono', 'Nimbus Mono L', Monaco, 'Courier New', Courier, monospace]"Principal": {
  "AWS": [
    "arn:aws:iam::111111111111:user/user-name1",
    "arn:aws:iam::111111111111:user/user-name2"
  ]
}[/font]


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:awsConfused3::Confused3bucketname",
"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.