Interview Prep/AWS/IAM and Access Errors

IAM policy validation: `MalformedPolicyDocument: Policy document should not specify a principal`. What happened?

IntermediateTroubleshootingIAM and Access Errors
Answer

Likely causes → A resource-based policy element was placed in an identity policy.

Diagnose →

aws accessanalyzer validate-policy --policy-document file://p.json --policy-type IDENTITY_POLICY

Fix →

  1. Remove Principal from the identity policy
  2. Use a trust policy for roles instead
  3. Re-run validation

Prevent → Validate policies in CI by policy type.

aws All AWS questions Roadmap: AWS core services

More on IAM and Access Errors