Opscraft
AWS IAM & multi-account security · Lesson 7 of 7 · 4 min read

Interview questions and model answers

"How does AWS evaluate whether a request is allowed?"

Default deny. An explicit deny in any applicable policy wins. Otherwise the request must be allowed by every limiting policy that applies — SCPs and RCPs from Organizations, permissions boundaries, session policies — and granted by an identity-based policy or a resource-based policy. Cross-account requests need both the caller's identity policy and the resource's policy or role trust policy to allow it.

"Role vs user?"

A user has long-lived credentials; a role has none and is assumed to obtain temporary STS credentials, scoped by its permission policies and limited to principals its trust policy allows. Humans should come in through Identity Center, and workloads should use roles — instance profiles, IRSA or Pod Identity, OIDC for CI — so there are no static keys to leak.

"How does IRSA work?"

The EKS cluster's OIDC issuer is registered as an IAM identity provider. A role trusts it, with conditions pinning the namespace and service account in the sub claim. The service account is annotated with the role ARN, and the webhook injects a projected token and environment variables, so the SDK calls AssumeRoleWithWebIdentity and gets credentials for that pod only. Pod Identity is the newer alternative that avoids per-cluster OIDC providers and uses associations through the EKS API.

"What are SCPs and what can't they do?"

Organization policies that set the maximum permissions for principals in member accounts — guardrails like region restrictions, protecting CloudTrail and GuardDuty, denying leaving the org or creating IAM users. They never grant permissions, don't apply to the management account or service-linked roles, and must be tested carefully because a bad deny affects every account below the OU.

"How do you implement least privilege at scale?"

Roles per workload defined in IaC, Access Analyzer to generate policies from actual CloudTrail activity and to flag unused permissions and external access, resource-scoped ARNs and conditions, ABAC with tags for many teams, permissions boundaries to let teams create roles safely, SCP guardrails at the org level, and policy linting in CI.

"A developer's access key was found on a public GitHub repo. What do you do?"

Deactivate the key immediately, then use CloudTrail to see everything it did across regions, remove anything the attacker created, rotate any secrets it could read, check the bill, and then fix the root cause: replace the key with SSO or roles, enable secret scanning and push protection, add GuardDuty alerting and an SCP preventing access key creation where possible.

"Why use multiple AWS accounts?"

Accounts are the hardest isolation boundary — they contain blast radius, separate quotas and billing, and allow different guardrails per environment. A landing zone with Security, Infrastructure, Workloads (prod and non-prod) and Sandbox OUs, centralised logging and Identity Center access is the standard pattern, usually provisioned with Control Tower or AFT.

"What's the confused deputy problem and how does External ID help?"

A third-party service that assumes roles in many customers' accounts could be tricked by one customer into accessing another customer's role. Requiring a unique External ID in the trust policy, which the vendor ties to each customer, prevents that. Inside AWS services, the equivalent is aws:SourceArn and aws:SourceAccount conditions on service principals.