DEV Community

Cover image for ๐Ÿ“˜ AWS IAM Explained Desi-Style โ€” With Hall Passes, Boundaries & Principalโ€™s Final Word! (Part 2)
Utkarsh Rastogi for AWS Community Builders

Posted on โ€ข Edited on

๐Ÿ“˜ AWS IAM Explained Desi-Style โ€” With Hall Passes, Boundaries & Principalโ€™s Final Word! (Part 2)

๐ŸŽ’ Welcome back to the IAM School Series!

In Part 1, we decoded IAM with fun school analogies:

  • ๐Ÿ‘จโ€๐Ÿซ IAM = Principal
  • ๐Ÿ‘ฉโ€๐ŸŽ“ Users = Students
  • ๐ŸŽซ Policies = Hall Passes
  • ๐Ÿงช AWS Services = Classrooms

This time, we dive into the hidden layers of IAM โ€” Permission Boundaries, Inline Policies, and the all-powerful Explicit Deny โ€” the final word from your school's Principal! ๐Ÿซ


๐Ÿšช Part 2: โ€œHall Pass Hai, Par Boundary Ke Bahar Nahi Ja Sakta!โ€

Ever had this moment?

โ€œPolicy mein allow hai, phir bhi access denied aa raha hai?โ€

Welcome to the world of:

  • โœ… Managed vs Inline Policies
  • ๐Ÿšง Permission Boundaries
  • โ›” Explicit Deny overrides all

Letโ€™s understand it Desi-Style! ๐Ÿ‡ฎ๐Ÿ‡ณ


๐Ÿงฑ IAM Policy Types โ€” The School Way

IAM Concept School Analogy Purpose
Managed Policy Official Hall Pass Booklet Reusable permission sets for many users
Inline Policy Note from Class Teacher Custom permission for one specific student
Permission Boundary Principalโ€™s Fence Rule Max area a student can operate in
Explicit Deny Rulebook says โ€œStrictly Prohibitedโ€ Overrides any permission

๐Ÿซ School Example 1: The Curious Student and The Lab Room

๐Ÿ‘จโ€๐ŸŽ“ Utkarsh, a science student, receives:

  • ๐Ÿ“ An Inline Policy from the Chemistry Teacher:

    "Utkarsh can access the Chemistry Lab anytime."

  • ๐Ÿšง But the Principalโ€™s Boundary Rule says:

    "No one is allowed in labs after 5 PM."

๐Ÿ•” Utkarsh tries to enter the lab at 5:30 PM.

๐Ÿšซ Access Denied!

Even with permission, the boundary overrides it.


๐Ÿ’ป Real AWS Example 1: EC2 Access Blocked by Boundary

IAM User: dev-user

โœ… User Policy:

{
  "Effect": "Allow",
  "Action": "ec2:StartInstances",
  "Resource": "*"
}
Enter fullscreen mode Exit fullscreen mode

โŒ Permission Boundary:

{
  "Effect": "Allow",
  "Action": "s3:*",
  "Resource": "*"
}

Enter fullscreen mode Exit fullscreen mode

๐Ÿ” Result:

Even though the user has EC2 access in their policy, the boundary allows only S3 actions.

๐Ÿงฑ Boundary is the boss! ๐Ÿ”’


๐Ÿซ School Example 2: Guest Lecturer Blocked by Rules

๐Ÿ‘จโ€๐Ÿซ Mr. Sharma (a guest lecturer) has:

  • ๐Ÿ›๏ธ A visitor pass signed by the Principal (Trust Policy)
  • ๐Ÿงพ Permission from the subject teacher to teach in Room 7B (Permissions Policy)

But the Rulebook says:

"No guest lecturers allowed during exam week."

โŒ Result: Access Denied

โ›” Explicit Deny wins โ€” always!


๐Ÿ’ป Real AWS Example 2: Lambda + Trust + Deny

๐Ÿ›‚ Trust Policy (Allows Role Assumption):

{
  "Effect": "Allow",
  "Principal": {
    "Service": "lambda.amazonaws.com"
  },
  "Action": "sts:AssumeRole"
}
Enter fullscreen mode Exit fullscreen mode

โœ… Permissions Policy:

{
  "Effect": "Allow",
  "Action": "dynamodb:PutItem",
  "Resource": "arn:aws:dynamodb:<Region>:<AccountID>:table/StudentData"
}
Enter fullscreen mode Exit fullscreen mode

โŒ Explicit Deny:

{
  "Effect": "Deny",
  "Action": "dynamodb:*",
  "Resource": "*"
}
Enter fullscreen mode Exit fullscreen mode

๐Ÿ” Result:

Access denied โ€” even though permissions exist โ€” because explicit deny overrides all.


๐Ÿงพ Inline vs Managed โ€” Who Gets What?

Policy Type School Analogy Best Use Case
Managed Policy Printed Hall Pass for all Sports Students Reusable across teams or departments
Inline Policy Special Note: "Only Utkarsh can use Art Room" Unique, user-specific scenarios

๐Ÿซ School Example 3: Project Day Chaos

๐Ÿง‘โ€๐ŸŽ“ Aman wants to access the Computer Lab.

  • โœ… Has Managed Policy: "Can access all labs"
  • โœ… Has Inline Policy: "Access only to Computer Lab"
  • โŒ Principal sets Boundary: "Only Bio students allowed in labs today"

๐Ÿ” Result: โŒ Access Denied

Boundary wins over all other permissions.


๐Ÿ’ป Real AWS Example 3: S3 Uploads Within Boundaries

IAM User: awslearner

๐Ÿ“ Inline Policy:

{
  "Effect": "Allow",
  "Action": "s3:PutObject",
  "Resource": "arn:aws:s3:::project-submissions/*"
}
Enter fullscreen mode Exit fullscreen mode

๐Ÿšง Permission Boundary:

{
  "Effect": "Allow",
  "Action": "s3:PutObject",
  "Resource": "arn:aws:s3:::project-submissions/*"
}
Enter fullscreen mode Exit fullscreen mode

โœ… Access works

Because the action is allowed in both the user policy and the permission boundary.

โ— But if the user tried s3:DeleteObject, it would be denied, as it's not included in the boundary.


๐Ÿง  IAM Evaluation Flow โ€” Principal Ki Marzi

  • โœ… Check userโ€™s policies โ€” is action allowed?
  • โœ… Is it within permission boundary?
  • โŒ Any explicit deny?
  • โœ… Final result = All above must match โœ…

๐Ÿ“Œ IAM is AND logic โ€” all doors must open.


๐ŸŽ“ Summary โ€” IAM Isnโ€™t Just Hall Passes

IAM Element School Equivalent Notes
Policy (Managed/Inline) Hall Pass / Teacher Note Grants permission
Permission Boundary Principalโ€™s Area Restriction Sets max what a user can ever do
Explicit Deny Rulebook with โ€œNo Exceptionsโ€ Overrides every Allow

โœ… Key Takeaways from Part 2

  • โœ… Permissions arenโ€™t enough โ€” boundaries and denies matter too
  • ๐Ÿ“ Inline = user-specific; Managed = reusable
  • ๐Ÿ” Always check boundaries during IAM debugging
  • โ›” Explicit Deny is the final word โ€” like a strict principal!

๐Ÿ”œ Whatโ€™s Next?

๐ŸŽฏ Part 3 Coming Soon:

"IAM Roles & STS โ€” Guest Lecturers & Temporary Access Explained"

Weโ€™ll explore:

  • sts:AssumeRole
  • Temporary credentials
  • Cross-account access (like inter-school guest lectures)

IAM ka syllabus abhi pura nahi hua! ๐Ÿง‘โ€๐Ÿซ

Stay tuned โ€” and remember: โ€œHall pass ke bina entry allowed nahi hai!โ€ ๐ŸŽซ


๐Ÿ‘จโ€๐Ÿ’ป About Me

Hi! I'm Utkarsh, a Cloud Specialist & AWS Community Builder who loves turning complex AWS topics into fun chai-time stories โ˜•

๐Ÿ‘‰ Explore more


๐Ÿ—ฃ๏ธ Your Feedback = My Fuel

If this made IAM:

  • Easy to understand ๐Ÿ’ก
  • Fun to learn ๐ŸŽ‰
  • Or gave you a school flashback ๐ŸŽ’

Then share it, comment, or just say hi โ€” it helps me keep the chai warm and the blogs coming! โ˜๏ธ๐Ÿ’ป


Jai Cloud! Jai Code! Jai IAM! ๐Ÿ‡ฎ๐Ÿ‡ณ๐Ÿš€

Top comments (3)

Collapse
 
pravesh_sudha_3c2b0c2b5e0 profile image
Pravesh Sudha โ€ข

I really like the authenticity and the Desi-panna of the Post, Keep posting buddy!!

Collapse
 
awslearnerdaily profile image
Utkarsh Rastogi โ€ข

Thanks Buddy it really motivates me if it help any learners

Some comments may only be visible to logged-in visitors. Sign in to view all comments.