AWS IAM Policies Interview Questions: Evaluation Logic and Security Quiz

Reviewed by Mark Dickie · Last updated

6 questions on this page you can answer and see marked on the spot. Go to the first one

AWS IAM policies are JSON documents that allow or deny specific API actions on specific resources for a principal. Interviewers use them to test whether you can read a policy, predict what it grants, and spot where it grants too much. Expect questions on evaluation order, how an explicit Deny overrides an Allow, and when a resource-based policy is needed instead of an identity-based one.

How does AWS decide whether a request is allowed?

An explicit Deny in any applicable policy wins, whatever Allow statements exist elsewhere. Without a Deny, the request needs an Allow from every layer that applies:

  1. Service control policies on the account or its parent OU must allow the action.
  2. A permissions boundary on the user or role, if one is set, must allow it.
  3. A session policy passed through AssumeRole or federation, if present, must allow it.
  4. An identity-based or resource-based policy must grant it. Cross-account access usually needs an Allow on both the caller's identity policy and the target resource's policy.
Policy elementWhat it controlsCommon interview trap
EffectWhether a matched statement allows or deniesAn explicit Deny in any policy beats every Allow.
Action / NotActionAPI calls such as s3:GetObjectAllow with NotAction grants everything except the listed actions.
ResourceARNs the statement coversarn:aws:s3:::bucket and arn:aws:s3:::bucket/* cover different S3 actions.
ConditionExtra checks such as aws:SourceIp or aws:MultiFactorAuthPresentA key the request does not send can make the condition fail to match.
PrincipalWho a statement covers, in resource-based and trust policies onlyPutting Principal in an identity-based policy is invalid.

Practise by reading a policy aloud and stating what it allows before you check the answer.

Key facts

  • Tarmac has 16 AWS interview questions on this topic, 10 of them on this page, at difficulty 1–5 of 5.
  • Tarmac tracked 2,755 job postings asking for AWS in November 2026.
  • Roles asking for AWS advertise a median base salary of £80,000, across 1,117 job postings as of November 2026.
  • Tarmac last reviewed these AWS interview questions on 3 December 2026.

At a glance

Questions10 shown · 16 in the bank
Difficulty1–5 of 5
FormatsMultiple choice, True / false, Design exercise, Short answer, Flashcard, Multiple answer, Find the bug, Ordering, Fill in the blank

What you'll review

  1. iam policies

Practice questions

Try one before you open the answer. Pick an option and press Check; it's marked on the spot.

In an AWS IAM policy statement, the Effect element determines whether the statement explicitly allows or denies access. Which two values are valid for the Effect element?#

Options

Show answer

The Effect element in an AWS IAM policy statement accepts exactly two values: Allow and Deny. Deny always takes precedence over Allow when both are present, making explicit denies a powerful tool for enforcing security boundaries.

Why:

The IAM policy Effect element accepts exactly two values: Allow and Deny. Deny always overrides any Allow. The terms Permit, Reject, Grant, Revoke, Enable, and Disable are not valid Effect values.

In AWS IAM, a newly created IAM user with no policies attached (and no group memberships) can, by default, list the S3 buckets in its own AWS account.#

Options

Show answer

A new IAM user with no policies attached cannot list S3 buckets, or do anything else. AWS IAM denies every request by default (an implicit deny), so the user needs a policy that explicitly allows an action such as s3:ListAllMyBuckets. Being in the same account gives no permissions.

Why:

IAM is deny by default, which AWS calls an implicit deny. A new IAM user with no identity-based policies, either attached directly or inherited through groups, has no permissions at all. A call like s3:ListAllMyBuckets is denied until some policy explicitly allows it. Being in the same account does not grant any access on its own.

Your team runs a small web app on a single EC2 instance. The app has to read and write objects under the uploads/ prefix of one S3 bucket, acme-app-data, and do nothing else in AWS. Right now a developer has put long-term IAM user access keys, with AmazonS3FullAccess attached, into the app's config file. Redesign how the app gets its AWS permissions. Describe the IAM identity you would use, how the instance gets credentials, and roughly what the permissions policy should contain.#

Show answer

I would delete the IAM user's access keys from the config and deactivate them, then create an IAM role whose trust policy lets ec2.amazonaws.com assume it. I would attach the role to the instance through an instance profile. The AWS SDK then gets temporary credentials from the instance metadata service, and those credentials rotate automatically, so the app stores no long-term secrets. I would also replace AmazonS3FullAccess with a custom policy: Effect Allow, Action ["s3:GetObject","s3:PutObject"], Resource "arn:aws:s3:::acme-app-data/uploads/". If the app needs to list its files, I would add a second statement allowing s3:ListBucket on arn:aws:s3:::acme-app-data with a condition of s3:prefix = "uploads/". Because of default deny, the app can't do anything else.

Why:

The core ideas here are basic IAM best practice. Workloads on EC2 should use roles with temporary credentials, not stored user access keys. Permissions should follow least privilege, which means limiting both the actions and the resource ARNs. Note that object actions apply to object ARNs, while bucket actions apply to the bucket ARN.

An IAM user has an identity policy that allows s3:ListBucket and s3:GetObject with a single Resource of arn:aws:s3:::app-logs/*. Downloading objects works, but aws s3 ls s3://app-logs returns AccessDenied. Explain why, and say how to fix the policy.#

Show answer

s3:ListBucket is a bucket-level action, so it has to match the bucket ARN arn:aws:s3:::app-logs. The ARN arn:aws:s3:::app-logs/* only matches objects inside the bucket. GetObject is an object-level action, so it works. ListBucket never matches, so the request is implicitly denied. To fix this, add the bucket ARN arn:aws:s3:::app-logs as a resource for s3:ListBucket, either as a separate statement or as a second ARN in the Resource list. Keep the /* ARN for s3:GetObject.

Why:

Each S3 action applies to a specific resource type. s3:ListBucket works on the bucket itself (arn:aws:s3:::bucket). s3:GetObject works on objects (arn:aws:s3:::bucket/*). A Resource with only the object ARN never matches a ListBucket request. With no matching Allow, IAM falls back to an implicit deny. Adding the bare bucket ARN for ListBucket fixes it.

A user has an identity policy that Allows s3:DeleteObject, but a separate attached policy explicitly Denies s3:DeleteObject on the same bucket. What is the result of a delete request?#

Options

Show answer

The request is denied. IAM is deny-by-default, and an explicit Deny in any applicable policy always overrides every Allow — there is no 'Allow wins' and no cancelling-out. Policies are unordered, so 'last attached wins' is false, and it is irrelevant whether the Allow and Deny live in the same document. This is exactly how guardrails such as Service Control Policies and permission boundaries cap permissions that no downstream Allow can re-grant.

Why:

IAM evaluation is deny-by-default with one absolute rule: an explicit Deny anywhere in any applicable policy short-circuits the decision to Deny, regardless of how many Allows exist. There is no 'Allow overrides Deny' and no cancelling-out. Policies are not ordered, so 'last attached wins' is fiction, and it makes no difference whether the statements share a document. This is the mechanism behind guardrails like SCPs and permission boundaries — you Deny broadly to cap permissions no downstream Allow can re-grant.

An IAM role has AdministratorAccess attached as its identity policy, plus a permissions boundary that allows only s3:* and dynamodb:*. Can the role call ec2:RunInstances? Explain how permissions boundaries combine with identity policies.#

Show answer

No. A permissions boundary sets the maximum permissions an identity-based policy can grant. It does not grant anything by itself. For an action to be allowed, both the identity policy and the boundary must allow it. ec2:RunInstances is allowed by AdministratorAccess but is not allowed by the boundary, so it is implicitly denied. The reverse also holds: if the boundary allows an action but no identity policy does, the action is still denied. Within the same account, a resource-based policy that names the role ARN as principal can still grant access even if the boundary does not allow it.

Why:

For a principal in the same account, the effective permissions come from the intersection of its identity-based policies and its permissions boundary. Here AdministratorAccess allows EC2, but the boundary does not. Because the action falls outside that intersection, it is implicitly denied. Permissions boundaries are often used to delegate role creation safely, because they cap what any attached policy can grant.

An IAM user has only this identity-based policy attached. No SCPs, permissions boundaries, or resource policies apply.#

Options

Pick every one that applies.

Show answer

An IAM statement with Effect: Allow and NotAction: iam:* allows every action except IAM actions, including actions from services AWS launches later. It does not deny IAM actions. They are only implicitly denied, so another policy that explicitly allows an IAM action such as iam:CreateUser still grants it. To block IAM actions for certain, use an explicit Deny statement.

Why:

NotAction combined with Effect: Allow allows every action except the ones listed, so s3:GetObject is allowed. It also covers actions from services AWS adds later, which is why this pattern is risky. It does not deny the IAM actions. They are just not allowed by this statement, so they fall under the default implicit deny. Any other policy that explicitly allows iam:CreateUser overrides an implicit deny, so the user could then create users. The claim that the statement "explicitly denies all iam:* actions" is wrong, because explicit denies come only from statements with Effect: Deny. The claim that the user is "limited to IAM actions only" gets the meaning backwards.

This identity policy is meant to let a service read and write objects in only the reports-prod bucket. A security review flags it. What is the real problem?#

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": ["s3:GetObject", "s3:PutObject"],
      "Resource": "*"
    }
  ]
}

Options

Show answer

Resource: "*" grants the actions on every object in every bucket, not just reports-prod — it should be arn:aws:s3:::reports-prod/*

Why:

The actions are scoped correctly, but Resource: "*" applies them to every object in every bucket in the account — a massive over-grant that violates least privilege. The fix is the bucket's object ARN, arn:aws:s3:::reports-prod/* (and arn:aws:s3:::reports-prod for bucket-level actions if needed). The Version date 2012-10-17 is the current, correct policy-language version — it is not a year you bump. Multiple actions in one statement is normal, and you would never broaden to s3:* to fix an over-permissive policy. Over-broad Resource is one of the most common and dangerous real-world IAM mistakes.

The AWS IAM documentation gives a policy evaluation flowchart for a request made by a principal to a resource in the same AWS account. Put these evaluation stages in the order that flowchart checks them. (Resource control policies are left out to keep this simple.)#

Put these in order

Show answer

In the AWS IAM same-account flowchart, the stages run in this order: the explicit Deny check, Organizations SCPs, resource-based policies, identity-based policies, permissions boundaries, then session policies. An explicit Deny found anywhere wins straight away. A resource-based Allow can grant access early within one account. The later stages each limit permissions, so the request is implicitly denied if any of them has no matching Allow.

Why:

The documented flowchart starts by checking every applicable policy for an explicit Deny. Any match ends evaluation with a denial. Next it checks SCPs: if the principal's account is in an organization and no SCP allows the action, the request is implicitly denied. Then it checks resource-based policies. Within one account, an Allow there can grant access on its own, depending on which principal it names. After that come identity-based policies, then permissions boundaries, and last session policies, such as those passed to AssumeRole. Each of these later stages acts as a gate: without an Allow at that stage, the request ends in an implicit deny.

A team writes an IAM identity policy with "Effect": "Allow", "Action": "ec2:CreateTags", and the condition "ForAllValues:StringEquals": {"aws:TagKeys": ["env", "team"]}. They expect it to allow only requests that send the tag keys env/team. However, when the request includes no tags, so the aws:TagKeys key is missing, a ForAllValues condition evaluates to _____ (true/false). To also require that the key is present, they add a second condition that uses the _____ condition operator with the value "false" on aws:TagKeys. Separately, for a single-valued operator such as StringEquals, adding the suffix _____ makes the condition evaluate to true when the key is absent from the request context.#

Show answer

A team writes an IAM identity policy with "Effect": "Allow", "Action": "ec2:CreateTags", and the condition "ForAllValues:StringEquals": {"aws:TagKeys": ["env", "team"]}. They expect it to allow only requests that send the tag keys env/team. However, when the request includes no tags, so the aws:TagKeys key is missing, a ForAllValues condition evaluates to true (true/false). To also require that the key is present, they add a second condition that uses the Null condition operator with the value "false" on aws:TagKeys. Separately, for a single-valued operator such as StringEquals, adding the suffix IfExists makes the condition evaluate to true when the key is absent from the request context.

Why:

A ForAllValues condition checks that every value in the request's multivalued key appears in the policy's list. When the key is missing or empty there are no values to check, so the condition passes, which means it evaluates to true. As a result, an Allow statement that uses it also matches requests that send no tags at all. The standard fix is to add a Null condition with "aws:TagKeys": "false", meaning the key must be present and non-null. The ...IfExists suffix (for example StringEqualsIfExists) changes what happens when a key is absent: the condition evaluates to true instead of false. This matters for statements where the key may not exist for every action or request.

Related interview questions

Job market

See aws salaries and hiring demand from live job postings.

The other 6 questions

This page shows 10 and marks what you pick. That's as far as a page can go. A free account opens the other 6 and keeps every answer. What you miss comes back until it's right: after a day, then at longer gaps.

Start with this topic

Free · the whole bank · 100 answers per 30 days, each marked with written feedback

Interview booked? Practise the job ad instead

What moved, monthly

One email a month when the bulletin comes out: what moved in the markets we track, and the new question topics we published. Confirm your address to join. Unsubscribe any time.