Cloud IAM
Policies
Master identity-first security in cloud environments: who can access what, how permissions work, and why IAM is the foundation of cloud security.
What is IAM?
Identity and Access Management (IAM) is a framework of policies, technologies, and processes that ensures the right individuals have the right access to the right resources at the right time.
Why Identity-First Security?
Traditional security built walls around networks (perimeter-based). Cloud computing shattered that model: resources are accessed from anywhere, by anyone, over the internet. Identity became the new perimeter.
Key IAM Concepts
Anatomy of an IAM Policy
The Principle of Least Privilege
The most fundamental rule in IAM: grant only the minimum permissions necessary for a principal to perform its job. Nothing more.
Authentication vs. Authorization
| Authentication (AuthN) | Authorization (AuthZ) | |
|---|---|---|
| Question | Who are you? | What can you do? |
| Mechanism | Passwords, MFA, certificates | IAM policies, roles, ACLs |
| Happens | First (identity verification) | Second (permission check) |
| Failure | "401 Unauthorized" | "403 Forbidden" |
| Example | Logging in with username + MFA | Policy allows s3:GetObject |
Policy Evaluation Logic
Types of IAM Policies
Users, Groups, and Roles
How to Write an IAM Policy
Example 1: Read-Only S3 Access
Scenario: A data analyst needs to read files from a specific S3 bucket called analytics-data, but should not be able to upload, delete, or modify anything.
Example 2: Deny Without MFA
Scenario: An organization wants to block all actions on critical production resources unless the user has authenticated with multi-factor authentication (MFA).
Example 3: Cross-Account Role Access
Scenario: Account A (Development) needs to access an S3 bucket in Account B (Production). Instead of sharing credentials, Account B creates a role that Account A can assume.
Common Mistakes
IAM Policy Summary
| Concept | Key Point | Best Practice |
|---|---|---|
| Least Privilege | Minimum permissions only | Scope actions + resources |
| Policy Evaluation | Deny > Allow > Implicit Deny | Explicit Deny for guardrails |
| Principals | Users, groups, roles | Use groups + roles, not users |
| Conditions | Context-aware restrictions | Require MFA, IP, encryption |
| Cross-Account | Assume roles via STS | Temporary credentials always |
| Auditing | Review unused permissions | Access Analyzer + CloudTrail |
Question 1 of 5
What does the Principle of Least Privilege require when configuring IAM policies?
Question 2 of 5
A user has an Allow policy for s3:PutObject and a separate Deny policy for s3:PutObject on the same bucket. What happens when they try to upload a file?
Question 3 of 5
Which IAM principal type is best suited for granting an EC2 instance access to an S3 bucket?
Question 4 of 5
An IAM policy has "Action": "s3:*" and "Resource": "*" with Effect Allow. What is the security concern?
Question 5 of 5
What is the difference between an identity-based policy and a resource-based policy?