AWS Certified Solutions Architect – Professional
SCP vs RCP vs permissions boundary for SAP-C03
AWS documents SCPs as limits on what principals in member accounts can do, and RCPs as limits on what any caller, including one outside the organization, can do to resources in member accounts. A permissions boundary is a managed policy that caps a single IAM user or role. None of the three grants permissions.
Who each one governs
An SCP is principal-centric. It sets the maximum permissions of the IAM users and roles in member accounts, including each member account's root user, whichever resource they call. It does not affect principals from accounts outside the organization.
A resource control policy (RCP) is resource-centric. It sets the maximum permissions available on resources in member accounts. It applies to any principal that calls those resources, inside the organization or not, root users included. It does not apply to resources in an outside account when your principals call them.
A permissions boundary is set on one IAM user or role inside an account. The entity can perform only the actions allowed by both its identity-based policies and its boundary. When an SCP also applies, the SCP, the boundary and the identity-based policy must all allow the action.
SCPs and RCPs share some rules. Both need an organization with all features enabled. Neither applies to the management account: SCPs do not limit its users and roles, and RCPs do not limit its resources. Both apply to member accounts that are delegated administrators. Neither restricts service-linked roles.
When the control has to be an RCP
Take a bucket in a member account whose bucket policy grants access to an account outside the organization. An SCP on the member account does not apply to those outside users. An RCP attached to the member account, its OU or the root applies to the bucket even when the outside users make the call. A resource in an account has only the permissions that every level above it permits, even if the owner's resource-based policy allows full access to anyone.
AWS uses S3 upload encryption as the example of a control that can be written either way. As an SCP it stops your own principals from uploading unencrypted objects. As an RCP it requires encryption whenever any principal uploads, and AWS says that form may be preferred when the bucket accepts uploads from principals outside the organization, such as third-party vendors.
RCPs cover only a listed set of services, which includes Amazon S3, AWS KMS, AWS Secrets Manager, Amazon SQS, AWS STS and Amazon DynamoDB. Check the list before choosing an RCP for a service. RCPs do not apply to AWS managed KMS keys.
The AWS managed policy RCPFullAWSAccess is attached to the root, every OU and every account when RCPs are enabled, and it cannot be detached. RCPs therefore work through Deny statements. A Deny at the root or an OU is evaluated for every account beneath it, so an exception for one OU has to be written into the Deny that covers that OU. A separate policy lower down cannot lift a Deny inherited from above.
When the control is a permissions boundary
A boundary is the tool for delegating IAM work inside an account. An administrator lets other people create users or roles, and makes sure those new entities can never exceed a set policy. AWS shows the pattern: allow the IAM actions only when the iam:PermissionsBoundary condition key equals the ARN of the approved boundary policy.
In the AWS example, that condition sits on the create action and also on the actions that attach, put, detach and delete policies and that set a boundary. The delegate can then create entities only with the boundary attached, and can manage permissions policies only on entities that carry it. Entities without that boundary are outside the delegate's reach. Separate Deny statements stop the delegate from editing the boundary policy and from deleting a boundary.
The delegate's own boundary does not pass to what the delegate creates. AWS notes that the delegate in its example can create a user who reaches Amazon S3, which the delegate cannot use. The cap has to be attached to each new entity, which is what the condition on the create action forces.
An explicit deny in a boundary always wins. If the boundary denies a bucket, a bucket policy that allows the user still does not give access.
Using SCPs and RCPs together
SCPs and RCPs are independent. You can enable one type or both. AWS describes using both to build a data perimeter: an SCP keeps your identities from reaching resources outside your organization, and an RCP keeps identities outside your organization from reaching your resources.
The effective permissions are the intersection of what the SCPs and RCPs allow and what the identity-based and resource-based policies allow. Users and roles still need IAM policies that grant the action. A principal with no permission policy has no access, even if every SCP and RCP allows everything.
Where the exam catches people
- Believing an SCP at the root stops an outside account that a bucket policy lets in: SCPs limit only principals in the organization's member accounts, so this needs an RCP.
- Believing an RCP can be written for any service: RCPs apply only to the services on the supported list.
- Believing an RCP attached lower down can lift a Deny attached to the root: a Deny at any level applies to every account beneath it, so the exception belongs in the Deny itself.
- Believing a boundary on the developers' own role caps the roles they create: each new role needs the boundary attached, which the
iam:PermissionsBoundarycondition on the create action enforces. - Believing the
iam:PermissionsBoundarycondition is needed only on the create action: without it on the policy-attachment actions, the delegate can add policies to entities that have no boundary.