01 / 20

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.

Cyber 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.

Identity
Who is making the request? A user, a service, or an application.
Access
What actions are they allowed to perform? Read, write, delete, or admin.
Management
How are permissions controlled, audited, and revoked over 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.

PERIMETER MODEL Firewall Server DB Trust inside wall IDENTITY-FIRST MODEL IAM Cloud API Data Verify every request

Key IAM Concepts

Principal
The entity making a request: a user, group, role, or service account.
Action
The operation being requested: s3:GetObject, ec2:StartInstances, etc.
Resource
The specific cloud object being acted upon, identified by an ARN or resource path.
Effect
The decision: Allow or Deny. Deny always wins when policies conflict.

Anatomy of an IAM Policy

IAM Policy Document "Effect": "Allow" or "Deny": the permission decision "Action": "s3:GetObject" what operation is allowed "Resource": "arn:aws:s3:::my-bucket/*" "Condition": "IpAddress": "10.0.0.0/8" Required Required Required Optional

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.

Over-Privileged User s3:* ec2:* , iam:* ✕ Too much access Least Privilege User s3:GetObject Only on my-bucket/* ✓ Just enough access

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

1. Default: DENY ALL 2. Evaluate all policies 3. Any explicit Deny found? Yes DENY No 4. Any explicit Allow found? Yes ALLOW No Implicit DENY

Types of IAM Policies

Identity-Based
Attached to users, groups, or roles. Defines what that identity can do. Most common type.
Resource-Based
Attached to a resource (e.g., S3 bucket). Specifies who can access it and with what actions.
Permission Boundary
Sets the maximum permissions an identity can ever have. Acts as a guardrail.
Service Control (SCP)
Organization-wide limits. Applied at the account or OU level in AWS Organizations.

Users, Groups, and Roles

User Long-term credentials Group Collection of users Role Temporary credentials IAM Policy Cloud Resources

How to Write an IAM Policy

1
Identify the principal. Who needs access? A user, a Lambda function, an EC2 instance?
2
Determine the minimum actions. List only the specific API calls they need: e.g., s3:GetObject, not s3:*.
3
Scope to specific resources. Use ARNs to restrict access to exact buckets, tables, or instances: not *.
4
Add conditions if needed. Restrict by IP range, MFA requirement, time of day, or tags.
5
Test and audit. Use the IAM Policy Simulator, review CloudTrail logs, and refine permissions over time.

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.

{ "Effect" : "Allow", "Action" : "s3:GetObject", "Resource" : "arn:aws:s3:::analytics-data/*" } Grants access Read only One bucket

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).

{ "Effect" : "Deny", "Action" : "*", "Resource" : "arn:aws:s3:::prod-*", "Condition" : { "BoolIfExists": {"aws:MultiFactorAuthPresent": "false"} } }

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.

Account A (Dev) Dev sts:AssumeRole Assume Role Account B (Prod) Cross-Acct Role Trust policy: Account A S3: prod-data Temporary credentials issued via STS

Common Mistakes

✕ Wildcard Permissions
Using "Action": "*" or "Resource": "*" grants far too much access. Always scope to specific actions and resources.
✕ User-Level Policies
Attaching policies directly to users instead of groups or roles makes management impossible at scale.
✕ Ignoring Conditions
Not requiring MFA, IP restrictions, or encryption in conditions leaves policies weaker than necessary.
✕ Never Auditing
Unused permissions accumulate over time. Regularly review with Access Analyzer and CloudTrail logs.
✕ Sharing Access Keys
Embedding long-term access keys in code or sharing them between team members. Use roles with temporary credentials instead.

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?