Skip to content
Tech Interview Prep
Technical interview guide

IAM & Security Fundamentals

The principle of least privilege, and how roles/policies enforce it instead of relying on long-lived credentials.

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

Scope: Vendor-neutral IAM fundamentals with AWS IAM, STS, Access Analyzer, CloudTrail, and KMS references accessed 2026-08-30..

Overview

Curated: · Written: · Reviewed:

IAM & Security Fundamentals

In one line

Least privilege means each principal holds only the actions it needs on the resources it needs, granted through short-lived roles and scoped policies instead of long-lived keys. Reach for it whenever a human, workload or CI job needs cloud access, and whenever you are asked why a request was allowed or denied.

Key definitions

  • Authentication: establishes who or what is calling. A failure here is a 401.
  • Authorization: decides whether this principal may perform this action on this resource in this context. A failure here is a 403.
  • Trust policy: says which principals may assume a role. Permissions policies say what the session may do.
  • Permissions boundary: caps the maximum permissions one identity can receive. It grants nothing by itself.
  • Session policy: narrows one assumed session further, passed at AssumeRole time.
  • Confused deputy: a trusted service is tricked into acting for the wrong tenant. Fixed with an external ID (sts:ExternalId) or conditions on org ID or the OIDC sub claim.

Formulas and complexity

For a same-account request, the request is allowed only when no explicit deny applies and every applicable layer allows it:

Allowed=¬ExplicitDeny∧SCP∧Boundary∧IdentityAllow∧SessionPolicy\text{Allowed} = \neg\text{ExplicitDeny} \wedge \text{SCP} \wedge \text{Boundary} \wedge \text{IdentityAllow} \wedge \text{SessionPolicy}

STS credentials default to 1 hour and can run up to the role's MaxSessionDuration, which is 1 to 12 hours. Management events stay in CloudTrail event history for 90 days. Export the trail to S3 or CloudWatch Logs to keep them longer. Data events (S3 object-level, Lambda Invoke) are off by default and billed per event.

How it works

A request carries a principal, action, resource and context. AWS evaluates every applicable policy. An explicit deny ends the evaluation, and a missing allow fails the request by default.

yes no no yes no yes no yes no yes Request: principal, action, resource Explicit deny in any policy? Denied SCP allows action? Permissions boundary allows? Identity or resource policy allows, session policy permits? Downstream key policy, e.g. kms:Decrypt? Allowed

When access fails, name the stage that stopped it before you edit any policy. Adding an allow to fix a denial at the SCP or boundary stage widens blast radius and usually outlives the incident.

When to use and when not to

ChoiceUse whenAvoid when
Temporary role session via federationHumans, workloads, CIRarely avoid it for production access
Long-lived access keyLegacy system with no role supportAnything shared, embedded or unrotated
Identity policy grantThe principal's own workload needs the actionCross-account (also needs resource or trust side)
Resource policy grantCross-account, or per-resource controlSame-account grants that a role already covers
Permissions boundaryDelegating role creation to teamsExpecting it to grant access
SCPOrg-wide ceilings such as region or service bansGranting permissions; an SCP allow does not give access
ABAC with tags or attributesHundreds of teams and projectsSmall, stable sets of fixed roles

Traps interviewers probe

  • Reading an SCP allow as access. An SCP allow only lifts the ceiling. Fix: confirm the identity policy grants the action. If an SCP allows dynamodb:* but the identity policy has no dynamodb:PutItem, the PutItem call is an implicit deny.
  • Assuming the boundary and identity policy are unioned. The effective set is the intersection. Fix: an action must appear in both, so an identity allow outside the boundary still fails.
  • Using the object ARN for list calls. ListObjectsV2 needs s3:ListBucket on the bucket ARN (arn:aws:s3:::bucket), with a prefix condition. Fix: grant on the bucket ARN and scope the prefix with a condition.
  • Treating session expiry as containment. Deactivating an access key does not end sessions it already issued, and a second key created during the window keeps working. Fix: revoke the trust path, contain active sessions, and audit every key created during the window.
  • Passing roles on *. iam:PassRole on * lets a builder hand an admin execution role to a service it controls. Fix: scope the role ARN and add an iam:PassedToService condition.

Interview tips

Open by separating the three questions: authentication, authorization, accountability. Then name the mechanism you would use (federated role, scoped trust, explicit condition).

Expect these follow-ups:

  • What fails if the bucket policy allows the role but the KMS key policy does not?
  • Why does an external ID stop a confused deputy without authenticating anyone?
  • Which claim stops a fork's pull request from assuming the deploy role? Pin aud and the sub claim to the exact repository and branch.
  • Which CloudTrail fields show who assumed the role and what the session did? userIdentity, the session name or source identity, and the events that share that session.

30-second answer outline:

  1. Name the three questions and the 401 versus 403 distinction.
  2. Describe the mechanism: a federated identity assumes a short-lived role whose trust and permissions are both scoped.
  3. Name the evaluation stage that decides the case and the one control you would change.
  4. State the evidence: CloudTrail principal, session and outcome, and the date you reviewed it.

Feedback on this overview

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