IntermediateSecurity

Security and IAM

Control identity and access using IAM users, roles, and policies with least privilege and practical governance patterns.

What Is It? (ELI5)

IAM is a permission system. It decides who can do what on which AWS resource.

Why Do We Need It?

How It Works (Technical)

AWS IAMAzure Equivalent
IAM UserEntra user
IAM RoleManaged Identity / App Registration role assignment
IAM PolicyAzure RBAC role definition + conditions

Hands-on

# List IAM users
aws iam list-users --query "Users[].UserName" --output table

# Simulate policy permission
aws iam simulate-principal-policy --policy-source-arn arn:aws:iam::123456789012:user/dev-user \
  --action-names s3:PutObject --resource-arns arn:aws:s3:::my-bucket/*

Debugging Scenario

Problem

Deployment pipeline fails with AccessDenied for S3 and CloudFormation.

Interview Questions

Beginner: Why use IAM roles instead of sharing access keys?
Roles provide temporary credentials and reduce secret sprawl.
Intermediate: What is least privilege?
Grant only required actions on required resources for required duration.
Scenario: An EC2 app needs S3 read access only. How do you secure it?
Attach an instance role with read-only S3 policy scoped to a specific bucket path.

Real-world Usage

Enterprises integrate IdP federation for workforce users and use short-lived assumed roles for production operations.

Summary