Role Trust Policies
You'll learn: How trust policies act as the gatekeeper that decides who can step into an IAM role.
What is a Trust Policy?
A trust policy is a special type of policy attached to every IAM role that answers one question: "Who is allowed to assume this role?" While regular IAM policies define what actions a role can perform once assumed, the trust policy controls which identities can wear that role in the first place.
Think of it like a nightclub's guest list. The trust policy is the bouncer checking IDs at the door—only approved identities get in. Once inside (role assumed), the regular IAM policies determine what you can actually do (dance, order drinks, access the VIP area).
How Trust Policies Work
Trust policies use the same policy language you've already learned (Effect, Action, Resource), but they focus on the AssumeRole action. The policy specifies:
- Principal: Which identity (user, service, or account) can assume the role
- Effect: Allow or Deny
- Conditions (optional): Extra requirements like MFA or time windows
For example, a trust policy might allow:
- EC2 instances to assume a role (so they can access S3)
- Users from another AWS account to assume a cross-account role
- A specific service like Lambda to assume a role
Trust Policies vs Regular Policies
The trust policy controls access to the role itself, while the role's permission policies control what the role can do. Both must grant permission for anything to happen—it's a two-step authorization.
Key Takeaway: Trust policies are the gatekeepers of IAM roles, defining which identities are permitted to assume the role before any permissions are granted.