01 · Introduction
What is AWS IAM?
IAM (Identity and Access Management) is a global AWS service that controls who can access AWS and what they can do. It is the foundation of security in any AWS environment.
Simple Definition
IAM answers two questions:
1.
WHO are you? (Authentication — proving your identity)
2.
WHAT can you do? (Authorization — what actions are allowed)
Why Do We Need IAM?
Without IAM, everyone would use the root account (owner account), which is extremely dangerous. IAM lets us:
- Create separate accounts for each person (developer, admin, tester)
- Give only the permissions that person needs — Principle of Least Privilege
- Track who did what and when (audit trail)
- Allow third-party services to interact with AWS securely
- Manage access for thousands of users from one place
Root Account Warning
The
Root Account is created when you first create your AWS account. It has complete access to everything. You should NEVER use it for daily tasks and NEVER share it. Create an IAM Admin user instead.
Key Features of IAM
- Global service — IAM is not region-specific; it applies across all regions
- Free service — IAM itself has no additional charge
- Integrated with all AWS services
- Supports Multi-Factor Authentication (MFA)
- Provides temporary access through Roles
02 · Components
IAM Core Components
IAM has four main building blocks. Understanding each one is essential.
👤
IAM Users
A real person or application that needs access to AWS.
👥
IAM Groups
A collection of users sharing the same permissions.
🎭
IAM Roles
Temporary identity assumed by services, apps, or users from other accounts.
📋
IAM Policies
JSON documents defining what actions are allowed or denied.
1. IAM Users
An IAM User represents a single person or service. When created, a user has no permissions by default. Permissions are granted by attaching policies.
- Can have a Console Password (for AWS Management Console login)
- Can have Access Keys (for CLI/API access)
- Can belong to one or more groups
- Permissions can be attached directly or inherited from a group
2. IAM Groups
Groups make it easy to manage permissions for multiple users at once. Assign a policy to a group — all users in that group inherit it.
Key Rule
Groups can only contain
Users. Groups CANNOT contain other groups. A user can belong to multiple groups.
Example groups: Developers, Admins, DBAs, ReadOnly-Team
3. IAM Roles
A Role is not assigned to a person — it is assumed temporarily. Think of it like borrowing a badge. Roles are used when:
- An EC2 instance needs to access S3 (the instance assumes a role)
- A Lambda function needs to write to DynamoDB
- A user from another AWS account needs cross-account access
- Users logging in via SSO / Federation
Roles vs Users
User = permanent identity for a person (long-term)
Role = temporary identity for services or applications (short-term, auto-expires)
4. IAM Policies
A Policy is a JSON document that defines permissions. It specifies which AWS services and actions are allowed or denied, and on which resources.
- Can be attached to Users, Groups, or Roles
- Multiple policies can be attached to one identity
- AWS provides pre-built Managed Policies (e.g., AdministratorAccess, AmazonS3ReadOnlyAccess)
- You can create Inline Policies or Customer Managed Policies
03 · Policy Types
IAM Policy Types
| Policy Type |
Attached To |
Who Manages It |
Use Case |
| AWS Managed Policy |
Users, Groups, Roles |
AWS (pre-built) |
Common use cases like S3ReadOnly, AdminAccess |
| Customer Managed Policy |
Users, Groups, Roles |
You (your account) |
Custom rules specific to your org |
| Inline Policy |
Single User/Group/Role |
You (embedded) |
One-to-one, deleted with the identity |
| Resource-based Policy |
AWS Resource (e.g., S3 bucket) |
You |
Allow cross-account access to a specific resource |
| Permission Boundary |
Users, Roles |
You (admin sets max limit) |
Set the maximum permissions a user can ever have |
| SCP (Service Control Policy) |
AWS Org Accounts |
Org Admin |
Block services across entire AWS Organization |
Deny Always Wins
If there is an explicit
Deny anywhere in any policy, access is denied — even if another policy explicitly allows it. AWS uses
deny-by-default: everything is denied unless there is an explicit Allow.
04 · Policy Structure
IAM Policy JSON Structure
Every IAM policy is written in JSON. Understanding this structure is critical for the AZ and AWS exams, and for real-world work.
IAM Policy — JSON Structure
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowS3ReadOnly",
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::my-bucket",
"arn:aws:s3:::my-bucket/*"
],
"Condition": {
"StringEquals": {
"aws:RequestedRegion": "ap-south-1"
}
}
}
]
}
Breaking Down Each Field
| Field | Required? | Description | Example Values |
| Version |
Yes |
Policy language version. Always use 2012-10-17 |
2012-10-17 |
| Sid |
No |
Statement ID — a label for the statement |
AllowEC2Read |
| Effect |
Yes |
Whether to Allow or Deny the actions |
Allow / Deny |
| Action |
Yes |
Which AWS API actions to allow/deny. Use * for all. |
s3:PutObject, ec2:* |
| Resource |
Yes |
Which AWS resource(s) the statement applies to (ARN format). Use * for all. |
arn:aws:s3:::bucket-name/* |
| Condition |
No |
Optional extra conditions (time, IP, region, MFA, etc.) |
aws:MultiFactorAuthPresent: true |
ARN Format
ARN = Amazon Resource Name. It uniquely identifies every AWS resource.
Format:
arn:partition:service:region:account-id:resource
Example:
arn:aws:s3:::my-bucket (S3 has no region/account in ARN)
05 · Core Concepts
Authentication vs Authorization
These two terms are often confused. Both are handled by IAM but they are completely different concepts.
| Authentication | Authorization |
| Question |
"Who are you?" |
"What can you do?" |
| In IAM |
Login with username + password / Access Key |
Policies define what actions are permitted |
| Happens |
First (before anything else) |
Second (after identity is confirmed) |
| Example |
Logging into AWS Console |
Being allowed to create an EC2 instance |
| AWS Term |
Identity verification |
Permissions / Policies |
IAM Decision Flow
When a user or service tries to perform an action in AWS, IAM checks in this order:
- Is there an explicit Deny? → If yes, access is denied immediately
- Is there an explicit Allow? → If yes, access is granted
- Neither? → Access is denied (implicit deny — default)
Principle of Least Privilege
Always give users and services only the
minimum permissions they need to do their job — nothing more. This is one of the most important security principles in cloud computing.
06 · Security
MFA & Access Keys
Multi-Factor Authentication (MFA)
MFA adds an extra layer of security beyond just a password. Even if a password is stolen, the attacker cannot log in without the second factor.
- Factor 1: Something you know (password)
- Factor 2: Something you have (physical device / virtual authenticator app)
MFA Device Types in AWS
| Type | How it Works | Example |
| Virtual MFA App |
TOTP codes in a smartphone app |
Google Authenticator, Authy |
| Hardware TOTP Token |
Physical device with rotating code |
Gemalto device |
| FIDO Security Key |
USB/NFC hardware key — phishing resistant |
YubiKey |
| Hardware Key Fob |
Dedicated hardware for GovCloud |
SurePassID |
Must Enable MFA On
Always enable MFA on the
Root Account and all
Admin IAM Users. This is mandatory for any real-world AWS account.
Access Keys vs Console Password
There are two ways to access AWS — each uses different credentials:
| Console Password | Access Key |
| Used For |
AWS Web Console (browser) |
AWS CLI, SDK, API calls |
| Format |
Username + Password |
Access Key ID + Secret Access Key |
| Secret visible after? |
Can be reset |
Secret shown ONCE only — save immediately |
| Rotate |
Recommended regularly |
Recommended every 90 days |
| Share? |
Never share |
Never share — treat like a password |
Never Hardcode Access Keys
Never put Access Keys directly in your code or upload them to GitHub. Use IAM Roles for applications running on EC2, and use environment variables or AWS Secrets Manager for local development.
07 · Security Tools
IAM Security Tools
AWS provides built-in tools to audit and review your IAM configuration.
1. IAM Credentials Report (Account Level)
A downloadable CSV report of all IAM users and the status of their credentials — password last used, MFA enabled, access keys created/rotated, etc.
- Go to IAM → Credential Report → Download
- Useful for compliance audits
- Shows which users haven't logged in for a long time (potential inactive accounts)
2. IAM Access Advisor (User Level)
Shows which services a user has permission to access, and when they last accessed each service.
- Go to IAM → User → Access Advisor tab
- Helps you identify unused permissions → remove them (least privilege)
- Shows the last time each allowed service was actually used
When to Use Which Tool
Credentials Report → Use when you want a full overview of all users' security status (account-wide audit)
Access Advisor → Use when you want to fine-tune one specific user's permissions
3. IAM Policy Simulator
Test what a user, group, or role can or cannot do — without actually performing the action.
- Useful for testing before giving permissions to production users
- Access at: policy simulator tool in the IAM console
08 · Best Practices
IAM Best Practices
-
✓
Never use the Root account for daily tasks. Create an IAM admin user immediately after account creation and lock the root account away.
-
✓
One physical user = One IAM user. Don't share IAM users between people. Each person gets their own account.
-
✓
Use Groups to assign permissions. Attach policies to groups, not individual users. Makes it easier to manage at scale.
-
✓
Apply Principle of Least Privilege. Give only the minimum permissions required. Start with zero and add what is needed.
-
✓
Enable MFA for all users, especially the root account and admin users. This is the single most impactful security step.
-
✓
Rotate Access Keys regularly. Rotate every 90 days and immediately revoke keys for users who leave the organization.
-
✓
Use IAM Roles for applications and services (EC2, Lambda, etc.) instead of embedding access keys in code.
-
✓
Enforce a strong password policy. Set minimum length, require uppercase/numbers/symbols, and force rotation.
-
✓
Audit regularly with Credentials Report and Access Advisor. Remove unused users, permissions, and access keys.
-
✓
Never share or hardcode Access Keys. Use environment variables, AWS Secrets Manager, or IAM Roles instead.
09 · Quick Summary
Chapter Summary
Key Points to Remember
- IAM = Identity & Access Management — controls WHO can access WHAT in AWS
- IAM is a global service — not region-specific
- 4 main components: Users, Groups, Roles, Policies
- Groups contain Users only — groups cannot contain groups
- Roles are for temporary access (services, cross-account, federation)
- Policies are JSON documents with: Version, Statement, Effect, Action, Resource
- Effect is Allow or Deny — Deny always wins
- By default, everything is denied unless explicitly allowed
- MFA adds a second factor of security beyond just a password
- Access Keys are for CLI/API — Console Password is for the browser
- Use Credentials Report (account audit) and Access Advisor (user audit)
- Least Privilege Principle — give only what is needed, nothing more
What's Next?
Now that IAM is covered, the next topic is EC2 (Elastic Compute Cloud) — where you will launch virtual machines in the cloud and connect them to what you just learned about IAM Roles (so EC2 instances can securely access S3, RDS, and other AWS services).
Lab Connection
In the IAM Lab you already completed, you created Users, Groups, and Policies. In the next EC2 lab, you will create an IAM Role and attach it to an EC2 instance — that's how the instance gets permission to access other AWS services without any access key.
AWS Official Docs
Official Documentation — IAM
All links go to docs.aws.amazon.com — official AWS reference. Always verify facts here for assignments and exam prep.
Free Hands-On Labs
Practice IAM on real AWS with no credit card —
AWS Skill Builder has free browser-based labs. Also open the
IAM Console directly.