Preporato

SAA-C03 Study Guide

Design Secure ArchitecturesSecure Access to AWS ResourcesIAM Fundamentals (Users, Groups, Roles, Policies)

Key Concepts

  • IAM users represent individual identities

  • IAM groups simplify permissions management

  • IAM roles provide temporary credentials

  • IAM policies define permissions using JSON

  • Principal, Action, Resource, Effect, Condition

IAM Fundamentals: Users, Groups, Roles, and Policies

Overview

AWS Identity and Access Management (IAM) is the foundational service for controlling access to AWS resources. It enables you to manage authentication (who can sign in) and authorization (what permissions they have) for your AWS account.

IAM is a global service - it's not region-specific. When you create an IAM user or role, it's available across all AWS regions. Understanding IAM is critical for the SAA-C03 exam, as security accounts for 30% of the exam content, and IAM questions appear in nearly every domain.

Key Principle

IAM follows the principle of least privilege - grant only the permissions required to perform a task, nothing more. This is the most important security concept you need to understand for the exam.

Exam Tip

IAM questions appear in nearly every exam domain - expect 8-10 questions on IAM alone. Focus on understanding when to use roles vs users, and how policy evaluation works.


Architecture Diagram

The following diagram illustrates the core components of AWS IAM and how they interact:

IAM Architecture Overview
Figure 1: IAM Components - Users, Groups, Roles, Policies, and their relationships to AWS resources

Key Concepts

IAM Users

IAM Users

An IAM user represents a person or application that interacts with AWS. Each user has a unique identity within your AWS account.

User Credentials:

  • Console password - For AWS Management Console access
  • Access keys - For programmatic access (CLI, SDK, API)
    • Consists of Access Key ID + Secret Access Key
    • Maximum of 2 access keys per user

Important Characteristics:

  • Users are created with no permissions by default
  • Each user can belong to multiple groups (up to 10)
  • Permissions can be assigned directly or through groups
  • Users can have both console and programmatic access
  • ARN format: arn:aws:iam::account-id:user/username

IAM Groups

IAM Groups

An IAM group is a collection of IAM users. Groups simplify permission management by allowing you to assign policies to multiple users at once.

Key Characteristics:

  • Groups contain users only - you cannot nest groups within groups
  • A user can belong to multiple groups (up to 10)
  • Groups don't have credentials - they're purely for organizing users
  • When a policy is attached to a group, all members inherit those permissions
  • Groups do NOT have their own identity - they cannot be referenced as a principal

IAM Roles

IAM Roles

An IAM role is an identity with specific permissions that can be assumed by trusted entities. Unlike users, roles don't have permanent credentials - they provide temporary security credentials.

Who Can Assume Roles:

  • IAM users (same or different account)
  • AWS services (EC2, Lambda, etc.)
  • External users via federation (SAML, OIDC)
  • Applications

Role Components:

  1. Trust Policy - Defines who can assume the role
  2. Permissions Policy - Defines what the role can do

Common IAM Role Use Cases

Use CaseDescriptionExample
EC2 Instance RoleAllow EC2 instances to access other AWS servicesEC2 reading from S3 bucket
Cross-Account AccessAllow users from Account B to access Account A resourcesShared S3 bucket access
FederationAllow external identity providers to grant AWS accessCorporate AD users accessing AWS
Service-Linked RolePredefined role for specific AWS servicesAuto Scaling managing EC2
JSONExample Trust Policy (EC2)
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "Service": "ec2.amazonaws.com"
      },
      "Action": "sts:AssumeRole"
    }
  ]
}

IAM Policies

IAM Policies

Policies are JSON documents that define permissions. They specify what actions are allowed or denied on which resources.

Policy Types:

  • Identity-Based - Attached to users, groups, or roles
  • Resource-Based - Attached directly to resources (S3, SQS, etc.)
  • Permissions Boundary - Sets maximum permissions for users/roles
  • Service Control Policy (SCP) - Organization-level guardrails
  • Session Policy - Limits permissions for assumed role sessions

IAM Policy Types Comparison

TypeAttached ToUse Case
Identity-BasedUsers, Groups, RolesDefine what an identity can do
Resource-BasedResources (S3, SQS)Define who can access the resource
Permissions BoundaryUsers, RolesSet maximum permissions
Service Control PolicyAWS OrganizationsSet guardrails for accounts
Session PolicyTemporary sessionsLimit assumed role permissions

How It Works

Policy Document Structure

Every IAM policy follows this JSON structure:

JSONIAM Policy Structure
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "AllowS3ReadAccess",
      "Effect": "Allow",
      "Action": [
        "s3:GetObject",
        "s3:ListBucket"
      ],
      "Resource": [
        "arn:aws:s3:::my-bucket",
        "arn:aws:s3:::my-bucket/*"
      ],
      "Condition": {
        "IpAddress": {
          "aws:SourceIp": "192.168.1.0/24"
        }
      }
    }
  ]
}

Policy Elements Explained

ElementRequiredDescription
VersionYesAlways use 2012-10-17
StatementYesArray of permission statements
SidNoStatement identifier (for documentation)
EffectYesAllow or Deny
PrincipalConditionalWho the policy applies to (resource-based only)
ActionYesList of actions (e.g., s3:GetObject)
ResourceYesARN of resources the actions apply to
ConditionNoConditions that must be met

Policy Evaluation Logic

When a request is made, AWS evaluates all applicable policies:

IAM Policy Evaluation Logic
Figure 2: Policy evaluation flowchart - starting with implicit deny, checking for explicit deny, then checking for explicit allow
Policy Evaluation Rules
  • Explicit Deny always wins over any Allow
  • Implicit Deny is the default when no policy matches
  • Policies are evaluated using logical OR (any Allow grants access)
  • Within Organizations: SCPs further restrict effective permissions

Policy Evaluation Flow Diagram

IAM Policy Evaluation Flow
Figure 3: Complete policy evaluation flow showing how AWS evaluates policies when a request is made

Managed vs. Inline Policies

Managed vs Inline Policies

AspectManaged PoliciesInline Policies
ReusabilityCan attach to multiple identitiesOne-to-one relationship
MaintenanceUpdate once, applies everywhereMust update each identity
VersioningSupports up to 5 versionsNo versioning
DeletionExists independentlyDeleted with identity
AWS ProvidedYes (AWS managed policies)No
RecommendedYes (preferred approach)Only for strict 1:1 relationships

Use Cases

Use Case 1: Development Team Access

Scenario: A team of 5 developers needs read/write access to a specific S3 bucket and read-only access to DynamoDB.

Solution:

  1. Create an IAM group called Developers
  2. Attach two managed policies to the group
  3. Add all 5 developers to the group
JSONDeveloper Team Policy
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "s3:GetObject",
        "s3:PutObject",
        "s3:DeleteObject",
        "s3:ListBucket"
      ],
      "Resource": [
        "arn:aws:s3:::dev-bucket",
        "arn:aws:s3:::dev-bucket/*"
      ]
    },
    {
      "Effect": "Allow",
      "Action": [
        "dynamodb:GetItem",
        "dynamodb:Query",
        "dynamodb:Scan"
      ],
      "Resource": "arn:aws:dynamodb:*:*:table/dev-table"
    }
  ]
}

Use Case 2: EC2 Instance Accessing S3

Scenario: An EC2 instance running an application needs to upload files to S3.

Solution:

  1. Create an IAM role for EC2
  2. Attach a policy granting S3 write access
  3. Attach the role to the EC2 instance (Instance Profile)
Why Role over Access Keys?
  • No credentials stored on the instance
  • Credentials are automatically rotated by AWS
  • Permissions can be changed without modifying the application
  • Much more secure and is the recommended approach

Use Case 3: Cross-Account Access

Scenario: Account B users need to access an S3 bucket in Account A.

Solution:

  1. In Account A: Create a role with trust policy allowing Account B
  2. In Account A: Attach S3 access policy to the role
  3. In Account B: Grant users permission to assume the role

Best Practices

IAM Best Practices
  1. Follow Least Privilege - Start with minimum permissions, add as needed
  2. Use Roles Instead of Access Keys - Roles provide temporary, auto-rotating credentials
  3. Enable MFA for Privileged Users - Require MFA for console access and sensitive operations
  4. Use Groups for Permission Management - Never attach policies directly to users
  5. Regularly Review and Audit - Use IAM Credential Report and Access Advisor
  6. Use AWS Managed Policies When Possible - Automatically updated by AWS

Common Exam Scenarios

Exam Scenarios and Solutions

ScenarioSolutionWhy
Application on EC2 needs DynamoDB accessCreate IAM role, attach to EC2Roles provide temporary credentials, more secure than access keys
User needs admin access only during emergenciesCreate role with admin permissions, user assumes role when neededSeparation of duties, auditable
External contractors need temporary AWS accessUse IAM roles with federation or IAM Identity CenterNo permanent IAM users for temporary staff
Prevent accidental S3 bucket deletionUse SCP to deny s3:DeleteBucket at organization levelSCPs provide guardrails across accounts
Application needs to call AWS APIsUse IAM role (if on AWS) or IAM user with access keys (if external)Roles preferred; access keys only when necessary

Common Pitfalls

Pitfall 1: Using Root Account for Daily Tasks

Mistake: Using the root account email/password for regular operations.

Why it's dangerous:

  • Root has unlimited access that cannot be restricted
  • Cannot be restricted by IAM policies
  • No audit trail for specific actions

Correct Approach:

  • Create IAM users for all operations
  • Enable MFA on root account
  • Use root only for account-level tasks (billing, closing account)
Pitfall 2: Embedding Access Keys in Code

Mistake: Hardcoding access keys in application code or config files.

Why it's dangerous:

  • Keys can be exposed in version control
  • Difficult to rotate
  • No automatic expiration

Correct Approach:

  • Use IAM roles for AWS resources
  • Use environment variables or AWS Secrets Manager
  • Rotate keys regularly if they must be used
Pitfall 3: Overly Permissive Policies

Mistake: Using "Action": "*" and "Resource": "*" for convenience.

Why it's dangerous:

  • Violates least privilege principle
  • Increases blast radius of compromised credentials
  • Makes compliance and auditing difficult

Correct Approach:

  • Specify exact actions needed
  • Limit to specific resources using ARNs
  • Use conditions to further restrict access

Test Your Knowledge

Q

What is the maximum number of access keys an IAM user can have?

A1
B2
C3
DUnlimited
Q

Which statement about IAM groups is TRUE?

AGroups can contain other groups (nesting)
BGroups can be used as principals in policies
CA user can belong to a maximum of 10 groups
DGroups have their own credentials
Q

An application running on EC2 needs to access S3. What is the BEST approach?

ACreate an IAM user and embed access keys in the application
BCreate an IAM role and attach it to the EC2 instance
CUse the root account credentials
DShare access keys via environment variables


Quick Reference

ARN Format

TEXTIAM ARN Formats
arn:aws:iam::account-id:user/user-name
arn:aws:iam::account-id:group/group-name
arn:aws:iam::account-id:role/role-name
arn:aws:iam::account-id:policy/policy-name

Common IAM Actions

Common IAM Actions

ActionDescription
iam:CreateUserCreate an IAM user
iam:AttachUserPolicyAttach managed policy to user
iam:CreateRoleCreate an IAM role
sts:AssumeRoleAssume an IAM role
iam:PassRolePass a role to a service

IAM Limits

IAM Service Limits

ResourceDefault Limit
Users per account5,000
Groups per account300
Roles per account1,000
Managed policies per account1,500
Groups per user10
Access keys per user2

Further Reading

Related AWS Services

IAMSTSOrganizations