A developer's IAM user has two identity-based policies attached. One policy allows s3:GetObject on a specific bucket; the other explicitly denies s3:GetObject on that same bucket. No service control policy, permissions boundary, or resource-based policy is involved. When the developer tries to read an object from that bucket, what happens?
- The allow policy wins because it was attached to the user first
- The request is denied, because an explicit Deny in any applicable policy always overrides an Allow
- AWS grants the request because at least one policy contains an Allow statement for the action
- The IAM console prompts the developer to pick which of the two policies should apply
Why B? And why not the others?
Correct answer: B. The request is denied, because an explicit Deny in any applicable policy always overrides an Allow
IAM's policy evaluation logic follows a default-deny model in which an explicit Deny found in any applicable policy always overrides an Allow found elsewhere, no matter how many other policies grant the same action or where those policies live in the evaluation set. This holds even when the conflicting Allow and Deny are two separate identity-based policies attached to the same principal. The option claiming the outcome depends on which policy was attached first is wrong because IAM's evaluation engine does not track or consult attachment order or timestamps when deciding an authorization outcome. The option claiming a single Allow statement is sufficient regardless of other policies is wrong because it ignores the explicit-deny override, a rule that exists precisely so a narrow restriction can safely coexist with, and take priority over, a broader grant. The option describing an interactive console prompt is wrong because policy evaluation happens automatically and silently on every API call; there is no interactive step for a principal to resolve conflicting policies at request time.
Source: AWS IAM documentation: Policy evaluation logic — Determining whether a request is allowed or denied within an account