IAM is the foundation of AWS security and appears in nearly every exam scenario involving access control, resource permissions, and identity federation. You need to understand its core components, permission models, and how to apply least privilege in multi-account architectures. This topic tests your ability to design secure authentication and authorization strategies for AWS resources.
An IAM user is a permanent named identity within an AWS account that represents a person or application requiring long-term credentials. Each user can have a unique set of security credentials including console password and/or access keys (access key ID + secret access key).
How it works: You create an IAM user, attach permissions via policies, and the user authenticates using credentials. IAM users are account-specific and cannot be shared across AWS accounts without assuming roles. Users can belong to multiple groups, and permissions accumulate from all attached policies and group memberships.
An IAM group is a collection of IAM users that simplifies permission management by allowing you to attach policies to multiple users simultaneously. Groups are not true identities and cannot be referenced as a principal in resource-based policies.
How it works: You create a group, attach policies to it, and add users as members. Users inherit all permissions from every group they belong to. Groups cannot contain other groups (no nesting), and a user can belong to up to 10 groups.
An IAM role is an identity with permissions that can be assumed temporarily by trusted entities, including IAM users, AWS services, federated users, or principals from other AWS accounts. Roles provide temporary security credentials via the AWS Security Token Service (STS).
How it works: A role has two key policies-a trust policy (who can assume the role) and permission policies (what actions the role can perform). When an entity assumes a role, STS generates temporary credentials (access key ID, secret access key, and session token) that expire after a defined duration (1-12 hours for most roles, up to 36 hours for certain role chaining scenarios).
An IAM policy is a JSON document that defines permissions by specifying allowed or denied actions on AWS resources. Policies are the mechanism by which permissions are granted to identities (users, groups, roles) or resources.
How it works: Policies evaluate to Allow or Deny based on statements containing Effect, Action, Resource, and optionally Condition elements. AWS evaluates all applicable policies and uses an explicit Deny to override any Allow. If no policy explicitly allows an action, it is implicitly denied by default.
AWS evaluates permissions by combining all applicable policies and following a strict decision flow. Understanding this logic is critical for troubleshooting access denials and designing least-privilege architectures.
How it works: AWS starts with an implicit Deny for all requests. It then checks for explicit Deny statements in any applicable policy-if found, access is denied immediately. If no explicit Deny exists, AWS checks for explicit Allow statements. If at least one Allow is found and no Deny blocks it, access is granted. If no Allow exists, the request is denied.
MFA adds an extra layer of security by requiring a second authentication factor beyond username and password. AWS supports virtual MFA devices, hardware tokens, and U2F security keys.
How it works: After enabling MFA on an IAM user or root account, authentication requires both the password and a time-based one-time password (TOTP) or U2F response. You can enforce MFA in IAM policies using condition keys like aws:MultiFactorAuthPresent or aws:MultiFactorAuthAge.
Condition elements in IAM policies allow fine-grained access control by evaluating context keys like IP address, date/time, MFA status, or resource tags before granting permissions.
How it works: Condition blocks contain one or more condition operators (StringEquals, IpAddress, DateGreaterThan, etc.) that test context keys. The action is allowed only if all conditions evaluate to true. Common keys include aws:SourceIp, aws:CurrentTime, aws:PrincipalTag, and aws:RequestedRegion.
aws:SecureTransport to deny non-HTTPS requestsA permissions boundary is a managed policy that sets the maximum permissions an IAM entity can have, regardless of identity-based policies. It does not grant permissions itself-it only limits them.
How it works: You attach a permissions boundary to a user or role. Even if identity-based policies allow an action, the boundary must also allow it; otherwise, the action is denied. This is useful for delegating user/role creation without granting excessive permissions.
SCPs are organization-level policies in AWS Organizations that set permission guardrails for all accounts in an organizational unit (OU) or the entire organization. They do not grant permissions-they define maximum allowed permissions.
How it works: SCPs act as filters on top of all IAM policies in member accounts. Even if an IAM policy allows an action, the SCP must also allow it. SCPs affect all users and roles in an account, including the root user (except for actions like changing the root account password or enabling MFA).
EC2 instances access AWS services using IAM roles attached via an instance profile. The instance retrieves temporary credentials from the EC2 instance metadata service (IMDS).
How it works: You attach an instance profile (containing a role) to an EC2 instance at launch or after launch. The instance queries the metadata endpoint at http://169.254.169.254/latest/meta-data/iam/security-credentials/ROLE_NAME to retrieve temporary credentials, which are automatically rotated by AWS.
Cross-account access allows identities in one AWS account (Account A) to assume a role in another account (Account B) to access resources. This requires a trust relationship defined in the role's trust policy.
How it works: Account B creates a role with a trust policy that specifies Account A's principal (user, role, or account root). Account A's users or roles then call sts:AssumeRole to obtain temporary credentials for the role in Account B. Permissions in Account A must also explicitly allow sts:AssumeRole for the target role ARN.
sts:AssumeRole for the role ARNIdentity federation allows users from external identity providers (corporate directories, social logins, SAML providers) to access AWS resources without creating IAM users. AWS supports SAML 2.0, OpenID Connect (OIDC), and custom identity brokers.
How it works: Users authenticate with their external identity provider, which returns a token (SAML assertion or OIDC JWT). AWS STS exchanges this token for temporary AWS credentials via AssumeRoleWithSAML or AssumeRoleWithWebIdentity. These credentials are then used to access AWS resources according to the role's permissions.

IAM Access Analyzer uses automated reasoning to identify resources that are shared with external principals outside your AWS account or organization. It analyzes resource-based policies and generates findings for unintended access.
How it works: You enable Access Analyzer at the account or organization level and define a zone of trust (your account or organization). Access Analyzer continuously scans resource policies (S3 buckets, IAM roles, KMS keys, Lambda functions, SQS queues, Secrets Manager secrets) and reports any access granted to principals outside the zone of trust.
The credential report is an account-level CSV report listing all IAM users and the status of their credentials (passwords, access keys, MFA). Access Advisor shows service-level permissions granted to a user, group, or role and when those services were last accessed.
How it works: The credential report is generated on-demand and downloaded as a CSV file. It includes fields like password enabled, password last used, password last changed, MFA active, access key 1/2 active, and access key last rotated. Access Advisor displays permissions and last accessed timestamps, helping identify unused permissions for least-privilege refinement.

1. Scenario: A user has an identity-based policy allowing s3:PutObject on a bucket, but the S3 bucket policy explicitly denies all PutObject actions from that user's account. The user cannot upload objects and the exam asks why.
Correct Approach: Explicit Deny in any policy (resource-based or identity-based) always overrides Allow statements. The bucket policy's Deny takes precedence, blocking the action regardless of the user's Allow policy.
Check first: Verify if any policy (identity-based, resource-based, SCP, permissions boundary) contains an explicit Deny for the action-this immediately terminates the evaluation with a Deny.
Do NOT do first: Do not assume the identity-based Allow is sufficient. Candidates often overlook resource-based policies or SCPs, leading to incorrect answers when access is denied.
Why other options are wrong: Adding more Allow statements or attaching additional managed policies will not help if an explicit Deny exists-Deny always wins in AWS policy evaluation logic.
2. Scenario: An application running on an EC2 instance needs to write to DynamoDB. The exam asks for the most secure method to grant the necessary permissions.
Correct Approach: Attach an IAM role to the EC2 instance via an instance profile, with a policy granting DynamoDB write permissions. The application retrieves temporary credentials from the instance metadata service without embedding access keys.
Check first: Confirm the scenario involves AWS service-to-service access from EC2-this signals the use of IAM roles, not IAM users or access keys.
Do NOT do first: Do not create an IAM user with access keys and embed those keys in the application code or configuration files. This violates security best practices and is never the correct answer for EC2-based access.
Why other options are wrong: Embedding access keys creates long-term credentials that are difficult to rotate, can be exposed in version control, and increase risk of credential leakage. Roles provide automatic credential rotation and eliminate this risk.
3. Scenario: A Solutions Architect needs to allow users from a corporate Active Directory to access the AWS Management Console without creating IAM users. The exam asks which approach to use.
Correct Approach: Implement SAML 2.0 federation by configuring the corporate identity provider (IdP) as a SAML provider in IAM. Users authenticate with AD, receive a SAML assertion, and exchange it for temporary AWS credentials via AssumeRoleWithSAML.
Check first: Identify whether the scenario mentions an enterprise directory (Active Directory, Okta, Azure AD) or web/mobile apps. Enterprise directories require SAML 2.0; web/mobile apps use OIDC or Cognito.
Do NOT do first: Do not create individual IAM users for each AD user or attempt to use OpenID Connect for enterprise directories-OIDC is for web identity providers, not SAML-based enterprise IdPs.
Why other options are wrong: Creating IAM users defeats the purpose of federation and creates management overhead. OIDC is not designed for enterprise directories; it's intended for social logins and web identity providers.
4. Scenario: An organization uses AWS Organizations with multiple accounts. The security team needs to prevent any account from launching EC2 instances in specific regions. The exam asks how to enforce this restriction across all accounts.
Correct Approach: Create a Service Control Policy (SCP) that denies ec2:RunInstances for the restricted regions using the aws:RequestedRegion condition, and attach it to the root of the organization or specific OUs.
Check first: Confirm the scenario involves organization-wide enforcement across multiple accounts-this indicates the need for SCPs, which apply to all accounts in the organization.
Do NOT do first: Do not attempt to modify IAM policies in each individual account or use permissions boundaries on users. These approaches do not scale and can be bypassed by account administrators.
Why other options are wrong: IAM policies apply only within a single account and can be overridden by account administrators. Permissions boundaries apply to users/roles, not entire accounts. Only SCPs enforce restrictions at the organization level.
5. Scenario: A developer can create IAM users but must not be able to grant themselves or others full administrator access. The exam asks how to delegate user creation while preventing privilege escalation.
Correct Approach: Attach a permissions boundary to the developer's IAM user that defines maximum allowed permissions (e.g., allows specific services but denies IAM policy changes or admin actions). Grant the developer iam:CreateUser and iam:AttachUserPolicy with a condition that requires the permissions boundary to be attached to any created users.
Check first: Identify if the scenario mentions "delegating IAM management" or "preventing privilege escalation"-this signals the use of permissions boundaries to cap maximum permissions.
Do NOT do first: Do not grant the developer broad IAM permissions without restrictions or attempt to use SCPs for single-account user-level control-SCPs are for organization-wide account restrictions, not individual users.
Why other options are wrong: Without a permissions boundary, the developer can grant themselves full admin permissions through the users or roles they create. SCPs do not apply to individual users within a single account-they restrict entire accounts or OUs.
Task: Enabling cross-account access from Account A (trusting account) to resources in Account B (trusted account) using IAM roles
{ "Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Principal": {"AWS": "arn:aws:iam::ACCOUNT-A-ID:root"}, "Action": "sts:AssumeRole" }] }
arn:aws:iam::ACCOUNT-B-ID:role/CrossAccountRole).sts:AssumeRole for the Account B role ARN:{ "Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Action": "sts:AssumeRole", "Resource": "arn:aws:iam::ACCOUNT-B-ID:role/CrossAccountRole" }] }
aws sts assume-role --role-arn arn:aws:iam::ACCOUNT-B-ID:role/CrossAccountRole --role-session-name session-name.Task: Rotating IAM user access keys without downtime
Task: Configuring SAML 2.0 federation for AWS console access
{ "Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Principal": {"Federated": "arn:aws:iam::ACCOUNT-ID:saml-provider/ProviderName"}, "Action": "sts:AssumeRoleWithSAML", "Condition": { "StringEquals": { "SAML:aud": "https://signin.aws.amazon.com/saml" } } }] }
https://aws.amazon.com/SAML/Attributes/Role attribute.AssumeRoleWithSAML, and grants temporary credentials. Users are logged into the AWS console with the role's permissions.Q1: A company has multiple AWS accounts managed by AWS Organizations. The security team needs to prevent all accounts from using any services outside the us-east-1 and us-west-2 regions. What is the most effective way to enforce this restriction?
(a) Create an IAM policy denying all actions outside the specified regions and attach it to all users in each account
(b) Enable AWS Config in all accounts and create a rule to detect and alert on resource creation in other regions
(c) Create a Service Control Policy (SCP) denying all actions when aws:RequestedRegion is not us-east-1 or us-west-2, and attach it to the organization root
(d) Use permissions boundaries on all IAM roles across all accounts to restrict actions to the specified regions
Ans: (c)
Service Control Policies (SCPs) are the only mechanism that enforces restrictions organization-wide across all accounts, including limiting actions based on region. Option (a) is ineffective because IAM policies must be managed per account and can be overridden by account administrators. Option (b) only detects violations after the fact and does not prevent them. Option (d) applies only to individual users/roles and does not scale or prevent account admins from bypassing the restriction.
Q2: An application running on an EC2 instance must access objects in an S3 bucket. The security team requires that no long-term credentials be stored on the instance. What should a Solutions Architect do?
(a) Create an IAM user, generate access keys, and store them in the instance's environment variables
(b) Attach an IAM role to the EC2 instance with a policy granting S3 read permissions
(c) Embed access keys in the application code and encrypt the code with AWS KMS
(d) Configure an S3 bucket policy to allow access from the EC2 instance's IP address
Ans: (b)
Attaching an IAM role to the EC2 instance provides temporary credentials automatically rotated by AWS, eliminating long-term credentials. Option (a) violates the requirement by storing long-term credentials (access keys). Option (c) still uses long-term credentials even if encrypted. Option (d) does not authenticate the application and is IP-based, which is fragile and not a credential mechanism.
Q3: A user in Account A needs to assume a role in Account B to access an RDS database. The user has an identity-based policy in Account A allowing sts:AssumeRole for the Account B role ARN, but the assume role call fails. What is the most likely cause?
(a) The role in Account B does not have a trust policy specifying Account A as a trusted principal
(b) The user in Account A does not have MFA enabled
(c) The RDS database security group does not allow connections from Account A
(d) The role in Account B has a permissions boundary that blocks AssumeRole actions
Ans: (a)
Cross-account role assumption requires both an identity-based policy in Account A allowing sts:AssumeRole and a trust policy in Account B's role specifying Account A as a trusted principal. If the trust policy is missing or incorrect, the assume role call fails. Option (b) is incorrect unless the role's trust policy explicitly requires MFA (using a condition key). Option (c) is irrelevant to role assumption, which is an IAM operation, not network access. Option (d) is incorrect because permissions boundaries do not affect the assume role operation itself-they limit the permissions of the role after it is assumed.
Q4: A developer must be allowed to create IAM users but must not be able to grant those users administrator permissions. How can this be achieved?
(a) Grant the developer iam:CreateUser and iam:AttachUserPolicy, and attach a permissions boundary to the developer that prevents creating admin users
(b) Use an SCP to deny iam:AttachUserPolicy for any policy granting AdministratorAccess
(c) Grant the developer iam:CreateUser with a condition requiring a permissions boundary be attached to newly created users, and attach a boundary limiting maximum permissions
(d) Create an IAM group with limited permissions and require the developer to add all new users to this group only
Ans: (c)
The correct approach requires the developer to attach a permissions boundary when creating users, limiting the maximum permissions those users can receive. This prevents the developer from escalating privileges by creating admin users. Option (a) applies the boundary to the developer, not the created users, which does not prevent the developer from granting admin permissions to new users. Option (b) uses SCPs incorrectly-SCPs apply to entire accounts, not specific users or actions within a single account. Option (d) does not enforce the restriction; the developer could remove users from the group or create new groups.
Q5: A company wants to grant temporary access to an S3 bucket for a third-party AWS account while ensuring the third party cannot pass the role to other accounts. Which configuration should be used?
(a) Create a cross-account IAM role with a trust policy specifying the third-party account, and include an External ID in the trust policy condition
(b) Create an S3 bucket policy allowing the third-party account's root principal to access the bucket
(c) Share an IAM user's access keys with the third party and restrict the user's permissions to the S3 bucket only
(d) Enable S3 bucket versioning and grant the third-party account read-only access via an Access Control List (ACL)
Ans: (a)
Using a cross-account role with an External ID prevents the "confused deputy" problem, ensuring the third party cannot assume the role on behalf of other entities. The External ID acts as a shared secret between you and the third party. Option (b) grants access but does not address the confused deputy issue or prevent privilege escalation. Option (c) shares long-term credentials, which is a security risk and not temporary access. Option (d) uses ACLs, which are deprecated in favor of bucket policies and do not address role assumption or External ID requirements.
Q6: An IAM user has an Allow policy for s3:GetObject on a bucket, but the bucket policy has an explicit Deny for all GetObject requests from the user's account. What happens when the user attempts to download an object?
(a) Access is allowed because identity-based policies take precedence over resource-based policies
(b) Access is denied because explicit Deny always overrides Allow in AWS policy evaluation
(c) Access is allowed if the user has MFA enabled
(d) Access is denied only if the bucket is in a different region
Ans: (b)
AWS policy evaluation logic states that an explicit Deny in any applicable policy (identity-based or resource-based) always takes precedence over any Allow. Option (a) is incorrect because no policy type takes precedence over an explicit Deny. Option (c) is incorrect unless the bucket policy conditions require MFA, which is not mentioned. Option (d) is irrelevant-region does not affect policy evaluation logic for Deny statements.