AWS Builder Center
What I Learned About IAM: The Concept That Broke My Mental Model Twice

What I Learned About IAM: The Concept That Broke My Mental Model Twice

I thought I understood IAM after my first week with AWS. I could create a user, attach a policy, and get a green checkmark. It wasn't until things stopped working — quietly, with no error explaining why — that I realized I only understood half of it. Here's the half I was missing, and how I finally got it straight.

I am a computer science student specializing in cloud computing primarily in AWS

The mistake: treating IAM as "one gate"

My original mental model was simple: attach a policy to a user, and that policy decides what they can do. Clean, single source of truth, done.
That model works fine right up until you try to access an S3 bucket that has its own policy attached — a resource policy, sitting on the bucket itself, completely separate from anything attached to your user. The first time I hit this, I had an IAM policy that clearly allowed  s3:GetObject , and I still got  Access Denied . No indication of which side was blocking me. I spent close to an hour assuming my IAM policy syntax was wrong before I found the actual problem: the bucket policy didn't allow it.
The real model: for resources like S3 buckets that support resource-based policies, AWS evaluates both the identity-based policy (attached to your user or role) and the resource-based policy (attached to the bucket). Access is only granted where they agree. An explicit deny on either side wins, full stop — and if neither side has an explicit allow, the request fails by default anyway, since IAM denies by default.
Once I saw it as two gates instead of one, the debugging got dramatically faster: check the identity side, check the resource side, find where they disagree.

The second break: execution roles for services, not people

I thought I'd fully learned IAM after that. Then I built a Lambda function that needed to write to DynamoDB, and it failed silently — no crash, the function just... didn't write anything, with no error in the logs pointing at permissions.
This is where I learned that IAM isn't just about people logging in — it's about services acting on your behalf. A Lambda function doesn't inherit your permissions as the developer who wrote it. It runs under its own execution role, and that role needs its own explicit permissions for every single thing the function touches — reading from S3, writing to DynamoDB, publishing to SNS, whatever it is.
The mistake I kept making was assuming that if I could do something in the console, my Lambda function could do it too. Completely wrong. The function's permissions are entirely defined by the role attached to it, and nothing else.

What actually fixed my understanding

Two habits changed everything for me:
  1. Before deploying anything, I ask: "what identity is making this request, and what role or policy is attached to it?" Not "am I logged in with enough permissions" — the actual identity performing the action, which is often a role, not me.
  1. When something fails with no clear error, I check both sides before touching code. Identity-based policy first, then resource-based policy (if the resource supports one), then the execution role if a service is involved. Nine times out of ten, the "bug" was never in the application logic at all.

Why this matters more as you go further

IAM stopped being "the permissions thing you set up once" and became the layer that touches almost everything else in AWS. Every Lambda function, every EC2 instance calling other AWS services, every cross-account setup — it all comes back to the same two questions: what identity is acting, and what is it actually allowed to do.
If you're newer to this than I am: the confusing part isn't IAM's syntax, it's realizing there are usually two policies in play, not one. Once that clicks, most "mysterious" Access Denied errors stop being mysterious.

Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article