Course contentsShow
← Security
Lesson 1716 of 3,05235. Cloud Security - IAMFree lesson

Resource-Based vs Identity-Based Policies

Learn the distinction between policies attached to identities versus resources and how they interact in authorization.

Resource-Based vs Identity-Based Policies

You'll learn how policies can be attached to either identities or resources, and how these two approaches work together to grant access in cloud IAM.


Two Ways to Grant Permissions

In cloud IAM, you can attach policies in two fundamentally different places:

Identity-based policies attach to IAM users, groups, or roles. They define what that identity can do across various resources. Think of this as giving someone a badge with their permissions written on it—wherever they go, those permissions travel with them.

Resource-based policies attach directly to the resource (like a storage bucket, database, or queue). They define who can access this specific resource. This is like a guest list on a door—the door controls who gets in, regardless of what badge they're carrying.

How They Interact

When evaluating access, the cloud provider checks both types of policies:

  • Within the same account: Either an identity-based policy or a resource-based policy granting access is sufficient (if no explicit deny exists).
  • Cross-account access: A resource-based policy is typically required because it explicitly trusts another account's identities.

Analogy: Office Building Access

Identity-based policy = Your employee badge that grants you access to conference rooms, printers, and kitchens throughout the building.

Resource-based policy = A specific server room that has its own access list on the door, allowing certain people from other companies to enter for maintenance.

You need either your badge or to be on that specific room's list (or both).

When to Use Each

Use identity-based policies for managing what your users and services can do generally. Use resource-based policies when you need to grant access to external accounts or when managing permissions at the resource makes more sense (like a public website bucket).

Key Takeaway: Identity-based policies define "what can this identity do," while resource-based policies define "who can access this resource"—both are evaluated together during authorization decisions.