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

Utkarsh RastogiUtkarsh Rastogi
5 min read

๐ŸŽ’ 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 ConceptSchool AnalogyPurpose
Managed PolicyOfficial Hall Pass BookletReusable permission sets for many users
Inline PolicyNote from Class TeacherCustom permission for one specific student
Permission BoundaryPrincipalโ€™s Fence RuleMax area a student can operate in
Explicit DenyRulebook 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": "*"
}

โŒ Permission Boundary:

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

๐Ÿ” 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"
}

โœ… Permissions Policy:

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

โŒ Explicit Deny:

{
  "Effect": "Deny",
  "Action": "dynamodb:*",
  "Resource": "*"
}

๐Ÿ” Result:

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


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

Policy TypeSchool AnalogyBest Use Case
Managed PolicyPrinted Hall Pass for all Sports StudentsReusable across teams or departments
Inline PolicySpecial 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/*"
}

๐Ÿšง Permission Boundary:

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

โœ… 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 ElementSchool EquivalentNotes
Policy (Managed/Inline)Hall Pass / Teacher NoteGrants permission
Permission BoundaryPrincipalโ€™s Area RestrictionSets max what a user can ever do
Explicit DenyRulebook 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! ๐Ÿ‡ฎ๐Ÿ‡ณ๐Ÿš€

0
Subscribe to my newsletter

Read articles from Utkarsh Rastogi directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Utkarsh Rastogi
Utkarsh Rastogi

๐Ÿ‘จโ€๐Ÿ’ป AWS Cloud Engineer | Around 6 years of Corporate Experience | Driving Innovation in Cloud Solutions ๐Ÿ”ง Day-to-Day Tasks: Specialize in creating AWS infrastructure for Migration Projects. Leveraging services such as S3, SNS, SQS, IAM, Lambda, System Manager, Kinesis, OpenSearch, Cognito, Storage Gateway, Cloud Watch, API Gateway, AWS Event Scheduler, Secret Manager, ECS, Application Load Balancer, VPC among others. Additionally, I excel in crafting Splunk Dashboards and implementing alerting mechanisms for Cloud Watch logs to monitor failures. My approach involves constructing AWS infrastructure using the Serverless framework and Cloud Formation templates, while automating tasks through Boto3 (Python Scripting) Lambdas. ๐ŸŽฏ Passion: I am deeply passionate about continuously learning new technologies and eagerly anticipate the transformative impact of cloud computing on the tech landscape. ๐Ÿ“ง Connect: Feel free to reach out to me at awslearningoals@gmail.com. Let's connect and explore potential collaborations! https://www.linkedin.com/in/rastogiutkarsh/