Sub topic 9
How SCPs and RCPs fit into request evaluation
This chapter assumes you know how IAM evaluates a request inside one account, and that you have read the earlier chapters on SCP and RCP fundamentals. It shows where the two organization policy types sit in that evaluation.
Two filters, one decision
An SCP limits what principals (users and roles) in member accounts can do. An RCP limits what can be done to resources in member accounts. Neither grants permissions. They only set the outer boundary within which IAM policies can grant access.
When a request arrives, AWS gathers every policy that applies to it and evaluates them together. The result is Allow only if no policy denies the request and every required layer allows it.
The evaluation order
The order below shows the logic. AWS does not necessarily run the checks in this sequence.
- The request starts as an implicit deny.
- An explicit
Denyin any applicable policy ends the evaluation with a deny. This covers SCPs, RCPs, identity-based policies, resource-based policies, permission boundaries, and session policies. - The RCPs that apply to the resource must allow the request.
- The SCPs that apply to the principal's account must allow the request.
- A resource-based policy or an identity-based policy must grant access. Within one account, either one is enough. Across accounts, both are needed.
- A permission boundary or session policy, if present, must also allow the request.
"Allow at every level"
Inheritance means a request must be allowed by an SCP at the root, at each OU on the path, and at the account itself. An allow at one level does not rescue a missing allow at another. RCPs work the same way.
This is why AWS attaches the managed policies FullAWSAccess (SCP) and RCPFullAWSAccess (RCP) by default. They keep the allow condition satisfied until you add restrictions. If you detach FullAWSAccess without replacing it, everything is denied by omission, because no SCP allows anything.
Whose policies apply
The SCPs that apply come from the account of the principal making the request. The RCPs that apply come from the account that owns the resource. In a cross-account request, both sets can matter.
| Scenario | SCP checked | RCP checked |
|---|---|---|
| Role in account A reads an S3 bucket in account A | Account A | Account A |
| Role in account A reads an S3 bucket in account B | Account A | Account B |
| Principal outside the organization reads a bucket in account B | None | Account B |
The last row is the main reason RCPs exist. An SCP can never restrict a principal outside your organization, but an RCP on the resource side can.
What neither policy covers
- The management account is not affected by SCPs or RCPs.
- SCPs do not apply to service-linked roles.
- RCPs do not apply to calls made by service-linked roles, and they cover only services that support them.
Worked example
Account B owns a bucket whose bucket policy allows s3:GetObject to a role in account A. Account A's role also has an identity policy allowing it. An RCP on account B's OU contains the TLS-only deny from the writing chapter.
- A request over HTTPS passes the RCP, the SCP, and both IAM policies, so it is allowed.
- A request over plain HTTP hits the RCP's explicit deny, so it is denied even though both IAM policies allow it.
If account A's SCP denied s3:* instead, the HTTPS request would also fail, because the SCP check applies to the principal's account.
Exercise
A role in account A calls a DynamoDB table in account B. Account A's SCP allows the action. Account B's RCPs do not allow it for DynamoDB, and the table's resource policy and the role's identity policy both allow it. Is the request allowed, and why?
Show answer
It is denied. The RCPs of the resource's account (B) must allow the request at every level, and here they do not. The IAM allows cannot override that, because an RCP sets the maximum permissions on the resource.