Interview Prep/AWS/IAM and Access Errors

`An error occurred (AccessDenied) ... because no identity-based policy allows the s3:GetObject action` yet a bucket policy allows the user. Cross-account?

IntermediateTroubleshootingIAM and Access Errors
Answer

Likely causes → For cross-account, both the caller's account identity policy and the bucket policy must allow.

Diagnose →

aws s3api get-bucket-policy --bucket shared
aws iam list-attached-role-policies --role-name reader
aws iam simulate-principal-policy --policy-source-arn <arn> --action-names s3:GetObject --resource-arns arn:aws:s3:::shared/*

Fix →

  1. Add s3:GetObject to the caller role's identity policy
  2. Keep the bucket policy as is

Prevent → Treat cross-account access as two changes in your runbook.

aws All AWS questions Roadmap: AWS core services

More on IAM and Access Errors