Hints — Access Denied I - Lab 01
Open each hint only after you’ve spent time investigating on your own.
Hint 1 — Where to look
The role has a permissions policy attached, and it isn’t empty. Open the role in the IAM console and review its Permissions tab.
Hint 2 — What to look for
Look at the Action list in the inline policy statement. Which S3 actions are listed?
Reading an object and listing a bucket’s contents are two different API actions.
Hint 3 — The gap
The policy grants s3:ListBucket (list the bucket’s contents) but never grants
s3:GetObject (read an object’s contents). Without an explicit Allow for
s3:GetObject, IAM’s default is to deny it — this is called an implicit deny.
Spoiler Alert — Full Solution
Root cause: The role’s inline policy only grants s3:ListBucket. It never grants
s3:GetObject, so any request to read an object is implicitly denied — IAM denies by
default unless a policy explicitly allows the action.
To fix the policy:
- Open the IAM console and select the role from the stack Outputs
- Open the Permissions tab, find the inline policy, and click Edit
- Add
s3:GetObjectto theActionlist alongsides3:ListBucket - Click Next > Save changes
- Re-run the simulation for
s3:GetObjectin the IAM Policy Simulator — it should now show allowed
If you’re using the Simulate button inside the IAM console’s policy editor, remember
to set an explicit Resource ARN for each action instead of leaving the default *
— testing against * shows denied regardless of the policy, since this policy only
grants access to a specific bucket:
s3:ListBucket→ theBucketResourceArnvalue from Outputss3:GetObject→ theObjectResourceArnvalue from Outputs
References