Skip to content
Tech Interview Prep
Technical interview guide

Cloud IAM Policy Design

Writing least-privilege access policies for cloud resources, and avoiding the common over-permissioning failure modes.

Minutes to read
4
Practice MCQs
25
Interview Q&A
25
Edition
v5
Editorial status
Reviewed

Scope: AWS IAM, Google Cloud IAM, Azure RBAC/managed identity, and NIST SP 800-207 guidance current 2026-08-31.

Overview

Curated: · Written: · Reviewed:

Cloud IAM Policy Design

In one line

Design the smallest set of effective permissions a principal needs, then verify the outcome by evaluating the whole request. Reach for this whenever a role, service account or cross-account grant is created or reviewed.

Key definitions

  • Implicit deny: if no applicable policy allows the action, the request fails.
  • Explicit deny: wins over every allow in any applicable document, including SCPs and resource policies.
  • Permissions boundary: a ceiling on identity-based grants. It grants nothing by itself.
  • Session policy: caps one session at AssumeRole time. It intersects with the role's grants.
  • Trust policy: says who may assume a role. It grants assumption only, never access inside the role.
  • Confused deputy: a trusted service is steered into using its authority for another tenant. Controlled with sts:ExternalId and source conditions.

Formulas and complexity

For identity-based grants, the effective result is:

Allowed=((Identity∪Resource)∩Boundary∩Session∩SCP)∖ExplicitDeny\text{Allowed} = \big((\text{Identity} \cup \text{Resource}) \cap \text{Boundary} \cap \text{Session} \cap \text{SCP}\big) \setminus \text{ExplicitDeny}

Resource-policy grants that name a principal directly are not limited by that principal's boundary, so treat that path as a separate escalation route.

Numbers to quote: DurationSeconds defaults to 3600 and is capped by the role's MaxSessionDuration, which can be set up to 43200. AWS managed policies are limited to 6,144 characters.

How it works

Every applicable document is collected and evaluated against the same request. An explicit deny ends evaluation. Otherwise the request needs an allow in an identity or resource policy, and that allow must also sit inside the SCP, boundary and session policy. Caps narrow a grant but never add one.

yes no no yes no yes Request Explicit deny in any policy? Denied Allow in identity or resource policy? Inside SCP, boundary and session policy? Allowed

A resource path needs its own ARN form. s3:GetObject matches object ARNs such as arn:aws:s3:::bucket/2024/*. s3:ListBucket authorizes against the bucket ARN, so a listing grant on bucket/2024/* never matches. Scope it on arn:aws:s3:::bucket with an s3:prefix condition.

When to use and when not to

ChoiceUse whenAvoid when
Vendor job-function rolethe role fits the job and the vendor maintains itit over-grants and the blast radius is large
Reviewed custom rolethe required permission set is stablemany near-duplicate variants accumulate unreviewed
Resource policy grantone resource needs cross-account or service accessyou must manage many principals on the resource
Session policyone assumption needs narrower rightsyou are using it to hide an over-broad role
Stored static keya legacy system cannot federatealmost always; prefer temporary credentials

Traps interviewers probe

  1. Reading one document. A boundary, a bucket policy or an SCP can decide the outcome. Fix: reconstruct the full request context and list each layer's effect.
  2. Assuming a boundary grants. An action missing from the identity policy stays denied even if the boundary allows it. Fix: the identity policy must allow, and the boundary must not block.
  3. Trusting the account root in a trust policy. Any principal in that account can then assume the role if its own policy allows. Fix: name the exact role ARN, and for vendors add sts:ExternalId. Treat the external ID as a trust condition, not a secret.
  4. Assuming absent tags behave one way. A StringNotEquals deny matches when the key is missing. Fix: check each operator's behavior on absent keys and test it with a negative case.
  5. Copying STS keys into code. The keys expire and the job fails mid-run. Fix: let the SDK's credential provider refresh the assumed-role session, and size DurationSeconds and MaxSessionDuration to the run.

Interview tips

Open with the rule: the request is denied unless an allow applies and nothing denies it. Then name the layers you would check: SCP, boundary, identity policy, session policy, resource policy.

Expect these follow-ups:

  • Why does an explicit deny beat an allow? Because evaluation stops at any applicable deny.
  • How do you debug an AccessDenied? Read CloudTrail's errorMessage, which names SCP denials. Run aws iam simulate-principal-policy for identity, boundary and session layers. The simulator does not evaluate SCPs.
  • What does cross-account access need? Matching grants on both sides: a trust policy on the target role and an identity allow on the caller's side.
  • Why does a listing fail while reads work? ListBucket is scoped to the bucket ARN, not the object ARN.

30-second outline: state the goal (smallest effective permission set). Name the layers that cap and grant. Give one concrete grant with exact ARNs and the condition that binds it. Finish with the test: one expected allow and one expected denial, run against the simulator and CloudTrail.

Feedback on this overview

Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.