AWS IAM — Interview & Certification Prep

AWS Identity and Access Management

Controls who (identities) can do what (permissions) on which AWS resources.

When to use it: Always — every secure design starts with least-privilege identities, roles and policies.

What you’ll learn about IAM

13 lessons, from fundamentals to advanced architecture. Each explains the idea, then lists the points worth remembering:

Beginner

Identities, policies and least privilege

IAM controls authentication (who you are) and authorization (what you may do) in AWS. Principals — IAM users, roles and AWS services — are granted permissions by policies: JSON documents listing allowed or denied actions on resources, optionally constrained by conditions. The guiding principle is least privilege: grant only the permissions actually needed. By default everything is denied, an Allow opens a permission, and an explicit Deny always overrides any Allow.

  • Principals + policies (Allow/Deny actions on resources, with conditions)
  • Default is implicit Deny; explicit Deny beats any Allow
  • Least privilege is the baseline posture

Exam tip: Learn the evaluation order cold: explicit Deny > Allow > default (implicit) Deny. Many questions show a policy that "should" allow something but is overridden by a Deny or a missing Allow.

Source: AWS docs — IAM User Guide

Users vs Groups vs Roles

A user is a long-lived identity for one person or application, with optional long-term credentials (a password and/or access keys). A group is a collection of users you attach policies to, so permissions are managed by membership rather than per user. A role is an identity with NO long-term credentials that a trusted principal assumes to obtain temporary credentials — used by AWS services (EC2, Lambda), for cross-account access, and for federated logins. Prefer roles for workloads and groups for organizing human users.

  • User = long-lived identity; Group = a policy-bearing set of users
  • Role = assumable identity that yields temporary credentials
  • Attach policies to groups/roles, not one-by-one to users

Exam tip: Groups cannot be nested and cannot be a Principal in a policy. Services (EC2/Lambda) and cross-account access use ROLES, never users.

Source: AWS docs — IAM User Guide

ARNs — naming every resource

An ARN (Amazon Resource Name) uniquely identifies an AWS resource, e.g. arn:aws:s3:::my-bucket/report.pdf or arn:aws:iam::123456789012:role/app. The parts are arn:partition:service:region:account-id:resource. Policies reference resources by ARN in the Resource element, and many services identify a Principal by ARN. Global services like S3 and IAM omit the region field.

  • Format: arn:partition:service:region:account-id:resource
  • Policies target resources by ARN; wildcards (*) allowed within a segment
  • Global services (S3, IAM) leave the region blank

Exam tip: Recognize the ARN shape and that the account-id segment identifies ownership — key for cross-account questions.

Source: AWS docs — IAM User Guide

MFA and root account protection

Multi-Factor Authentication adds a second factor (a device code or hardware key) on top of a password. Enable MFA on the root user and on privileged IAM users, and avoid using the root user for daily work — create IAM identities instead. You can also require MFA for sensitive actions via a policy condition (aws:MultiFactorAuthPresent). Root has a few exclusive tasks (e.g. closing the account, changing certain account settings) but should otherwise be locked away.

  • Enable MFA on root and privileged users; don't use root day-to-day
  • Policy condition aws:MultiFactorAuthPresent can force MFA for sensitive actions
  • Root has a few exclusive tasks; secure it and step away

Exam tip: Best practices: MFA on root, remove/avoid root access keys, use IAM roles/users for everything else.

Source: AWS docs — IAM User Guide

Intermediate

Identity-based vs resource-based policies

Identity-based policies attach to a principal (user/group/role) and say what that principal can do. Resource-based policies attach to a resource (an S3 bucket policy, an SQS queue policy, a KMS key policy) and say who can access that resource — including principals from OTHER accounts, which is how cross-account access can work without assuming a role. When both exist within one account, the effective permission is the union of what each allows (still subject to any explicit Deny and, in an organization, SCP guardrails).

  • Identity-based → on the principal; resource-based → on the resource
  • Only resource-based policies have a Principal element and enable cross-account access
  • Effective permission = union of allows, minus any explicit Deny

Exam tip: S3 bucket policies, SQS/SNS access policies and KMS key policies are the classic resource-based examples — the ones with a Principal.

Source: AWS docs — IAM User Guide

Policy evaluation logic & explicit deny

When a request is made, AWS collects all applicable policies — identity-based, resource-based, permission boundaries, session policies and (in an org) SCPs — and evaluates them together. The decision: if any explicit Deny matches, the request is denied; otherwise an Allow is required somewhere; otherwise the implicit default Deny applies. A permission boundary or SCP can only REDUCE permissions — being in an SCP/boundary does not grant anything by itself.

  • Explicit Deny always wins, everywhere
  • You need an Allow AND no Deny AND to be within any boundary/SCP
  • Boundaries and SCPs cap permissions; they never grant them

Exam tip: If a scenario has an SCP or boundary plus an identity policy, the effective permission is the INTERSECTION (both must allow), minus any explicit Deny.

Source: AWS docs — IAM policy evaluation logic

Roles, STS and temporary credentials

IAM roles provide temporary, automatically-rotated credentials that a principal assumes via STS AssumeRole, avoiding long-lived access keys. EC2 instances receive a role through an instance profile; Lambda functions use an execution role; other services assume service roles to act on your behalf. A role has two policy sides: a trust policy (WHO may assume it) and a permissions policy (WHAT it can do once assumed). Preferring roles over static user keys is a core security best practice.

  • Roles = temporary credentials from STS, assumed by services/users
  • Two policies: trust policy (who can assume) + permissions policy (what it can do)
  • Avoid long-lived user access keys for workloads

Exam tip: EC2 uses an INSTANCE PROFILE to receive a role; STS AssumeRole issues the temporary credentials. "Attach a role, never store keys" is the expected answer.

Source: AWS docs — AWS STS

IAM roles for AWS services

AWS services assume roles to act on your behalf: EC2 (instance profile) to call APIs from an app, Lambda (execution role) to write logs and reach other services, ECS tasks (task role), and many managed services. The service is named as the trusted principal in the role's trust policy (e.g. lambda.amazonaws.com). This keeps credentials out of your code and lets you scope exactly what each workload can touch.

  • Service roles name the service (e.g. lambda.amazonaws.com) in the trust policy
  • EC2 → instance profile; Lambda → execution role; ECS → task role
  • Scope each workload's role to least privilege

Exam tip: A Lambda that writes to CloudWatch Logs and reads a DynamoDB table needs exactly those permissions in its execution role — nothing more.

Source: AWS docs — IAM User Guide

Comparison: IAM user vs role, identity vs resource policy

IAM user vs role: a user has long-term credentials for a persistent identity (a person or legacy app); a role has NO long-term credentials and issues temporary ones on assumption (services, cross-account, federation). Identity-based vs resource-based policy: identity policies live on the principal and say what it can do; resource policies live on the resource, name a Principal, and enable cross-account access. Permission boundary vs SCP: a boundary caps one IAM identity; an SCP caps whole accounts/OUs — both only restrict.

  • User = long-term creds; Role = temporary creds (prefer roles for workloads/cross-account)
  • Identity policy = on principal; Resource policy = on resource (has Principal, enables cross-account)
  • Boundary = per-identity cap; SCP = per-account/OU cap; both only restrict

Source: AWS docs — IAM User Guide

Advanced

Cross-account access patterns

There are two ways to grant access across accounts. (1) Assume-role: account A creates a role whose trust policy allows a principal in account B to AssumeRole; B assumes it and gets temporary credentials scoped by the role's permissions — the recommended, auditable pattern. (2) Resource-based policy: the resource in A (e.g. an S3 bucket, KMS key or SQS queue) directly names B's principal, so B uses its own credentials. Assume-role centralizes control and works for services that lack resource policies; resource policies avoid an extra hop for the few services that support them.

  • Assume-role: A's role trusts B; B gets temporary scoped credentials (recommended)
  • Resource policy: the resource in A names B's principal directly
  • Choose assume-role for auditability and services without resource policies

Exam tip: A role's trust policy defines WHICH accounts/principals can assume it; the permissions policy defines what they can then do. Both are required.

Source: AWS docs — AWS STS

Permission boundaries & SCPs

A permission boundary is a managed policy attached to an IAM user/role that sets the MAXIMUM permissions that identity can have — the effective permission is the intersection of the boundary and the identity's policies. It's used to safely let teams create their own roles without exceeding a cap. Service Control Policies (SCPs) are an AWS Organizations feature that caps permissions for entire ACCOUNTS/OUs. Neither grants anything — both only restrict.

  • Permission boundary = max permissions for one identity (intersection with its policies)
  • SCP = max permissions for whole accounts/OUs in an Organization
  • Both only CAP; they never grant permissions

Exam tip: Permission boundary vs SCP: boundary applies to a single IAM identity; SCP applies to accounts/OUs. Both are ceilings, not grants.

Source: AWS docs — IAM User Guide

IAM Access Analyzer & least-privilege tooling

IAM Access Analyzer helps find resources (buckets, roles, keys, queues) that are shared with external principals or the public, so you can catch unintended access. It can also generate least-privilege policies from CloudTrail activity and validate policies against best practices. It turns "are we accidentally exposing something?" from a manual review into an automated finding.

  • Finds resources shared externally/publicly (unintended access)
  • Can generate least-privilege policies from observed activity
  • Validates policies against best-practice checks

Exam tip: If a question asks how to DETECT resources shared outside the account/org, the answer is IAM Access Analyzer.

Source: AWS docs — IAM User Guide

Common permission failures

When a request is denied, work the evaluation logic: is there an explicit Deny (in any policy, boundary or SCP)? Is there an Allow at all? Is the Resource ARN correct (including the object path for S3)? For cross-account, is the trust policy present AND the permissions policy scoped? For KMS-encrypted resources, does the caller also have kms:Decrypt on the key? Missing KMS permissions is a classic hidden cause of "I can read the bucket policy but still get denied on the object".

  • Check for explicit Deny, then for a matching Allow, then the Resource ARN
  • Cross-account needs BOTH a trust policy and scoped permissions
  • Encrypted data also needs KMS key permissions (kms:Decrypt)

Source: AWS docs — IAM policy evaluation logic

Common AWS IAM interview questions

  1. How does AWS decide whether an API request is allowed, and why might a user with AdministratorAccess still get AccessDenied?

    Strong answer: gather all policies (identity, resource, boundary, SCP, session); an explicit Deny anywhere wins; otherwise you need an Allow; otherwise the implicit default Deny. Admin can still be denied by an explicit Deny, or capped by a permission boundary / SCP (effective permission is the intersection). Bonus: reading KMS-encrypted data also needs kms:Decrypt.

  2. An application on EC2 needs to read from an S3 bucket. How do you grant access securely, and how does AWS decide whether the request is allowed?

    A strong answer covers:

    • Use an IAM role via the instance profile (no stored keys)
    • Least privilege (only the needed action/resource)
    • Evaluation: explicit Deny beats Allow, default Deny
  3. An application in AWS Account A needs read access to an S3 bucket in Account B. How would you design that access?

    A strong answer covers:

    • Cross-account role assumed by A, or a bucket policy naming A
    • Temporary credentials — no shared long-lived access keys
    • Least privilege: scope to the exact prefix and actions
    • KMS key policy must also grant decrypt if the bucket is encrypted

    Common wrong turns:

    • Creating an IAM user in Account B and sharing its access keys
    • Making the bucket public to avoid cross-account setup
    • Granting s3:* on the whole bucket
  4. A developer has an IAM policy that allows s3:GetObject, but their request is still denied. Walk me through how you would investigate.

    A strong answer covers:

    • Explicit Deny anywhere wins over any Allow
    • Check all policy types: identity, resource, SCP, permission boundary
    • Encrypted object also needs kms:Decrypt
    • Use IAM policy simulator / Access Analyzer / CloudTrail to pinpoint

    Common wrong turns:

    • Assuming an Allow is enough without checking for an explicit Deny
    • Forgetting SCPs or permission boundaries can cap permissions
    • Overlooking the KMS key policy on encrypted objects
  5. How do you approach least privilege in practice when a team says "we do not know exactly which permissions the app needs yet"?

    A strong answer covers:

    • Start broad in a non-prod account, then tighten from observed usage
    • Use Access Analyzer to generate policies from CloudTrail activity
    • Permission boundaries cap what a delegated admin can grant
    • Roles over users; no long-lived keys

    Common wrong turns:

    • Shipping a wildcard policy to production "temporarily"
    • Granting Administrator access to unblock a deploy
    • Using IAM users with static keys for workloads
  6. When would you use an IAM role instead of an IAM user, and why does it matter?

    A strong answer covers:

    • Roles issue temporary, auto-rotated credentials via STS
    • Users hold long-lived credentials — a standing risk
    • Workloads and cross-account access should always use roles

    Common wrong turns:

    • Thinking a role needs its own access keys
    • Creating IAM users for applications or for app end users
  7. An application keeps its database password in an environment variable committed to git. How do you fix this properly?

    A strong answer covers:

    • Store in Secrets Manager, retrieve at runtime via an IAM role
    • Enable automatic rotation to bound credential lifetime
    • The role also needs kms:Decrypt on the encrypting key
    • Rotate the currently-exposed credential immediately — git history keeps it
    • Parameter Store is the cheaper choice when rotation is not needed

    Common wrong turns:

    • Removing the secret from HEAD but not rotating it
    • Assuming Parameter Store rotates credentials natively
  8. Your consumer app will have millions of end users. Should they be IAM users? How would you design authentication?

    A strong answer covers:

    • IAM is for AWS principals; app end users belong in Cognito
    • User pool = managed sign-up/sign-in/MFA issuing tokens
    • Identity pool exchanges a token for temporary AWS credentials
    • Federation supports social and enterprise SAML/OIDC sign-in

    Common wrong turns:

    • Creating an IAM user per customer
    • Confusing user pools with identity pools

Answer these with follow-ups and optional AI feedback in the AWS mock interviewer.

Other AWS services to study next

IAM rarely appears on its own in an exam question — these come up alongside it:

Related AWS topics