Identity and Access: IAM, Roles, and Multi-Account Guardrails
Module 2 · Design Secure Architectures

Identity and Access: IAM, Roles, and Multi-Account Guardrails

Design secure access to AWS resources: IAM users, roles, and policies, how AWS evaluates a request, temporary credentials with STS, IAM Identity Center, and multi-account guardrails with Organizations, SCPs, and Control Tower.

Who Can Do What, to Which Resource

Every AWS API call answers three questions: who is calling (the principal), what they want to do (the action), and to which resource. IAM is how you control the answers.

ConceptWhat it isUse it for
Root userThe account’s original identity with full, unrestricted accessAlmost nothing. Turn on MFA, don’t create access keys, lock it away
IAM userA long-lived identity with a password and/or access keysRare today. Prefer federation for people and roles for workloads
IAM groupA collection of users that share policiesManaging permissions for many users at once
IAM roleAn identity with no long-term credentials; anyone allowed to assume it gets temporary credentialsEC2 instances, Lambda functions, cross-account access, federated users
PolicyA JSON document of Allow/Deny statementsGranting or limiting permissions

Roles are the answer to most access questions on the exam. An EC2 instance that needs to read S3 gets an instance profile with a role, never access keys stored on disk. A Lambda function gets an execution role. Another AWS account gets a role it can assume.

Policy types

  • Identity-based policies attach to a user, group, or role: “this role can read bucket X.”
  • Resource-based policies attach to a resource: an S3 bucket policy, a KMS key policy, an SQS queue policy. They name which principals may act on the resource, including principals in other accounts.
  • Permissions boundaries set the maximum permissions an identity-based policy can grant to a user or role. Useful when you let developers create their own roles.
  • Service control policies (SCPs) and resource control policies (RCPs) in AWS Organizations set the maximum permissions for every principal or resource in an account.
  • Session policies narrow permissions further for a single assumed-role session.

Boundaries, SCPs, RCPs, and session policies never grant anything. They only limit.


How AWS Decides: Allow or Deny

For a request inside a single account, AWS evaluates every policy that applies. The simplified logic:

Request(default: deny)1. Explicit Denyin any policy?2. Guardrails allow?SCP, RCP, boundary, session3. Any Allow?identity or resourceDENYexplicit deny always winsDENYoutside the guardrailALLOWyesDENYimplicityesnoyesnonoyesSimplified for requests within one account. Cross-account access needs an Allow on both sides.

Three rules to memorize:

  1. Everything starts denied (implicit deny).
  2. An explicit Deny anywhere wins, no matter how many Allows exist.
  3. Cross-account access needs both sides: the caller’s identity policy must allow the action, and the resource policy (or the role trust policy) in the other account must allow the caller.

Temporary Credentials and Federation

AWS Security Token Service (STS) issues short-lived credentials. You meet it through AssumeRole (for roles and cross-account access) and through federation.

  • Cross-account access: Account B creates a role whose trust policy names Account A. A principal in Account A with permission to call sts:AssumeRole on that role gets temporary credentials for Account B.
  • Workforce access: IAM Identity Center connects your identity provider (Microsoft Entra ID, Okta, or its own directory) to every account in your organization. People sign in once and pick a permission set for each account. This is the recommended way for humans to reach AWS.
  • Application users: Amazon Cognito user pools handle sign-up and sign-in for your app’s customers. Identity pools exchange those identities for temporary AWS credentials, for example to upload directly to S3.

Cross-account access with a role, step by step:

AWS STSissues temporary credsAccount APrincipal (e.g., an app role)Identity policy allowssts:AssumeRole on B’s roleAccount BRole in Account BTrust policy: Account APermissions: read the bucketS3 bucket1. AssumeRole2. Trust policy allows A?3. Temporary credentials4. Call S3 with them

Multi-Account Guardrails

Large organizations use many accounts: separate accounts for production, development, security tooling, logging, and each team. An account is the strongest isolation boundary AWS offers; it limits blast radius, quotas, and billing.

  • AWS Organizations groups accounts into organizational units (OUs) with consolidated billing.
  • SCPs attached to an OU limit what any principal in those accounts can do. Classic examples: deny actions outside approved Regions, deny disabling CloudTrail, deny leaving the organization. SCPs don’t apply to the management account, so keep workloads out of it.
  • AWS Control Tower sets up a well-architected multi-account landing zone for you: a log archive account, an audit account, guardrails (called controls), and Account Factory for creating new accounts that follow the rules.
⚠️ Common Pitfall: Thinking an SCP Grants Permission

Common mistake: an exam answer attaches an SCP that “allows S3 access” so developers can use S3.

SCPs only set the ceiling. A developer still needs an identity-based policy that allows S3. If an answer relies on an SCP or a permissions boundary to grant access, it’s wrong.


Key Takeaway

Use roles and temporary credentials for workloads and cross-account access, IAM Identity Center for people, and Cognito for app users. Remember that explicit deny wins, guardrails (SCPs, RCPs, boundaries) only limit, and cross-account access needs an Allow on both sides. Use Organizations, SCPs, and Control Tower to govern many accounts.

🧪 Try It: Lock Down a Region and Read a Bucket With a Role

In a sandbox account:

  1. Create an S3 bucket and upload a file.
  2. Launch a small EC2 instance without a role. Run aws s3 ls s3://your-bucket. It fails: no credentials.
  3. Create an IAM role for EC2 with a policy allowing s3:GetObject and s3:ListBucket on only that bucket. Attach it to the instance as an instance profile. Run the command again. It works, and no keys are stored on the instance.
  4. Add an explicit Deny for s3:GetObject on one object prefix. Confirm that the deny wins.

If you have an Organizations sandbox, write (don’t attach to production) an SCP that denies all actions outside us-east-1 and us-west-2, with exceptions for global services such as IAM. Clean up when you’re done.

🧠 Knowledge Check

1. An application on EC2 needs to write to a DynamoDB table. What is the MOST secure way to give it access?

2. An identity policy allows s3:DeleteObject, but an SCP on the account denies it. What happens?

3. A company wants employees to sign in once with their corporate identity provider and access many AWS accounts. Which service fits best?

4. What do service control policies (SCPs) do?