Sub topic 11
Choosing the right control
This chapter helps you pick the right tool for a given guardrail. It assumes you can read IAM policy JSON, know the difference between identity-based and resource-based policies, and have read the earlier chapters on how SCPs and RCPs are attached, inherited, and evaluated.
The four tools in one view
AWS gives you four ways to limit access. They differ in who they constrain, where they live, and who can change them.
- SCP (service control policy): Sets the maximum permissions for IAM principals (users and roles) in member accounts. It is attached to the root, an OU, or an account.
- RCP (resource control policy): Sets the maximum permissions on supported resources in member accounts, no matter who calls. It is attached the same way as an SCP.
- Permission boundary: Sets the maximum permissions for one IAM user or role. It is attached to that principal inside an account.
- IAM policy: Grants or denies permissions. An identity-based policy is attached to a principal. A resource-based policy is attached to a resource.
Only IAM policies grant access. SCPs, RCPs, and permission boundaries only limit it. A request is allowed only when every applicable layer permits it and an IAM policy grants it.
| Control | Constrains | Lives in | Managed by | Grants access? |
|---|---|---|---|---|
| SCP | Principals in member accounts | Organization | Organization management account (or delegated administrator) | No |
| RCP | Supported resources in member accounts | Organization | Organization management account (or delegated administrator) | No |
| Permission boundary | One IAM user or role | One account | Account administrators with IAM permissions | No |
| Identity-based policy | The principal it is attached to | One account | Account administrators | Yes |
| Resource-based policy | Access to one resource | One account | Resource owners | Yes |
Start with the question: what are you controlling?
Most choices become obvious when you ask which side of the request you want to control.
- "What can our people and workloads do?" This is about the caller. Use an SCP.
- "Who can reach our data?" This is about the resource, including callers from outside your organization. Use an RCP.
- "What can this team's delegated admins create?" This is about limiting a role that other people can create or modify. Use a permission boundary.
- "What should this role be able to do?" This is about granting access. Use an identity-based policy.
- "Who may use this one bucket or key?" This is about a single resource. Use a resource-based policy.
When an SCP is the right choice
Use an SCP when the control is about the actions your own principals can take, and you want it to hold even if an account administrator grants broader permissions.
Typical SCP controls:
- Deny all requests outside approved Regions.
- Deny
organizations:LeaveOrganization. - Deny disabling security services such as CloudTrail or GuardDuty.
- Deny creating IAM users with access keys in accounts that should use only roles.
An SCP is a poor fit when the thing you need to protect is reached by principals in other organizations. SCPs only apply to principals inside your member accounts. An outside principal that a bucket policy trusts is not affected by your SCP.
SCPs also do not affect the management account, and they do not affect service-linked roles. If the control must apply there, an SCP cannot deliver it.
When an RCP is the right choice
Use an RCP when the control is about the resource and should apply regardless of the caller's identity or what the resource owner wrote in a resource-based policy.
Typical RCP controls:
- Require TLS for all S3 requests.
- Deny S3 access from principals outside your organization, except AWS services.
- Prevent confused deputy abuse by requiring source conditions for service principals.
An RCP applies to requests against supported resources in member accounts, including requests from principals outside your organization. That is the main reason to choose it over an SCP for data protection. An RCP does not apply to resources in the management account, and it covers only the services that support RCPs. Check the supported-services list before you rely on one.
When a permission boundary is the right choice
A permission boundary solves a different problem: delegation inside an account. Suppose you let developers create IAM roles for their applications. Without a limit, a developer could create a role with administrator access and escalate their own privileges. A boundary caps what any role they create can do.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowOnlyAppServices",
"Effect": "Allow",
"Action": [
"s3:*",
"dynamodb:*",
"logs:*"
],
"Resource": "*"
}
]
}You attach this as the boundary to a role. The role's effective permissions are the intersection of the boundary and its identity-based policies. The developer's own policy then requires that any role they create carries the boundary, using the iam:PermissionsBoundary condition key.
Choose a boundary over an SCP when the limit differs per team or per role. Organization-wide policies are shared and change slowly. Boundaries can vary role by role and are controlled by account administrators.
Combining the controls
These tools are layers, and they work best together. A common arrangement:
- SCPs at the root or on OUs for baseline behavior of principals, such as Region limits and protection of security services.
- RCPs at the root or on OUs for baseline protection of data, such as TLS and the organization identity perimeter.
- Permission boundaries for delegated role creation inside accounts.
- IAM policies for the actual grants.
Consider a requirement: "Nobody outside our organization may read our S3 data, and our developers may only use two Regions."
- The Region requirement is about what your principals do, so it is an SCP.
- The outside-access requirement is about who reaches the resource, so it is an RCP.
Using only an SCP for the second requirement would leave a gap. A bucket policy that grants access to an outside account's role would still work, because the SCP never evaluates that outside principal.
Gotchas when choosing
Action coverage differs
An SCP can restrict any action in a service for member-account principals. An RCP covers only the services that support it, and only some actions and condition keys apply. If your service is not supported, an RCP will silently not apply. Verify the service in the documentation first.
Conditions behave differently on resources
In an RCP, the Principal element must be "*". You limit who is affected with condition keys such as aws:PrincipalOrgID or aws:PrincipalArn. In an SCP, the Principal element is not used at all. Mixing the two forms up is a common authoring error.
Deny-only versus allow statements
RCPs support only a restricted set of effects in practice, and the usual approach is a deny list on top of the default RCPFullAWSAccess policy. An SCP can follow a deny-list strategy or an allow-list strategy. Prefer deny lists for both unless you have a strong reason to enumerate every permitted action.
A guardrail does not fix a missing grant
If a user is denied and you cannot find a deny statement, remember that a missing allow in an identity-based or resource-based policy produces the same result. Adding an SCP Allow will not help, because SCP allows grant nothing.
Worked example: picking the control
A team asks for three rules. Decide which control fits each.
| Requirement | Control | Reason |
|---|---|---|
| No account may leave the organization | SCP | It restricts an action by principals in member accounts. |
| All S3 traffic must use TLS | RCP | It is about requests to a resource, from any caller. |
| App developers may create roles, but those roles cannot use IAM actions | Permission boundary | It limits roles that delegated users create within an account. |
If you need to apply the TLS rule to a single bucket only, a bucket policy is enough. If you need it on every bucket in every account, an RCP gives you one place to manage it.
Exercise
Your security team wants to guarantee that no principal from outside your organization can read objects from any S3 bucket in your member accounts, even if a bucket owner adds a bucket policy that trusts an external account. Which control do you use, and why would an SCP not work?
Show answer
Use an RCP. An RCP applies to requests against supported resources in member accounts regardless of who the caller is, including principals from other organizations. An SCP only constrains principals inside your own member accounts, so it never evaluates the external caller and cannot block that access.
Exercise
A platform team lets developers create their own IAM roles. They want every role a developer creates to be unable to perform any action outside S3, DynamoDB, and CloudWatch Logs, and the limit should be different for each team. Should they use an SCP or a permission boundary?
Show answer
A permission boundary. The limit varies by team and applies to roles created by delegated users inside an account. A permission boundary can be set per role, and account administrators can require it with the iam:PermissionsBoundary condition key. An SCP is shared across an OU and is better for uniform baselines.