Sub topic 14
Troubleshooting denials caused by SCPs and RCPs
This chapter assumes you have read the earlier chapters on SCP and RCP fundamentals, inheritance, and request evaluation. It also assumes you can read CloudTrail events and run AWS CLI commands. Here you will learn how to tell whether an access denial comes from an SCP, an RCP, or something else. You will also learn how to find the responsible policy and fix it without removing a guardrail.
Start with the error message
Every denial is one of three kinds. An explicit deny is a matching Deny statement. An implicit deny means no policy allowed the request. A deny from a different policy layer, such as a permission boundary, is also possible. The message text tells you which one you have.
| Message fragment | What it means |
|---|---|
| `with an explicit deny in a service control policy` | A `Deny` statement in an SCP matched the request. |
| `because no service control policy allows the ... action` | An SCP allow list, or a missing `FullAWSAccess`, left the action without an allow at some level. |
| `with an explicit deny in a resource control policy` | A `Deny` statement in an RCP matched the request. |
| `because no resource control policy allows ...` | An RCP allow list left the action without an allow. This is rare, because most RCPs keep `RCPFullAWSAccess`. |
| `with an explicit deny in an identity-based policy` or `in a resource-based policy` | Not an SCP or RCP problem. Look at the IAM policies. |
| `no identity-based policy allows the ... action` | The principal was never granted the action. Guardrails are not involved. |
Messages that name the policy type are called enhanced denial messages. They appear mainly for same-account requests, and the exact wording varies by service. Some services return only a generic "not authorized" or "Access Denied" text. Cross-account requests often give less detail, so you may need CloudTrail to see the full message. If the message is generic, treat the denial as unclassified and investigate with the steps below.
A triage flow
The diagram shows the order of checks. It starts with the cheapest signals: the message text, then whether the principal or resource is exempt, then the policy list.
Check the exemptions first
Before you read any JSON, rule out the cases where an SCP or RCP cannot be the cause. These checks take seconds.
- SCPs do not affect the management account. If the denial happens there, look elsewhere.
- SCPs do not affect service-linked roles. They affect only principals in member accounts.
- RCPs do not apply to resources in the management account, and they affect only the services that support them.
- SCPs do not restrict resource-based access from principals in other organizations. The resource owner's RCP and resource policy govern that request, not the caller's SCP.
The reverse also matters. If an SCP seems to block a request that it should not touch, confirm that the principal really is in a member account and that the request is not made by a service-linked role.
Find the event in CloudTrail
CloudTrail records the denial, including the full errorMessage. Use the account where the request was made. For a cross-account request, also check the account that owns the resource. The lookup-events command covers management events from the last 90 days. It does not return S3 object-level or other data events. For those, query a trail in Athena or an event data store in CloudTrail Lake.
This command lists recent denials that mention an SCP or an RCP. It requires jq.
aws cloudtrail lookup-events \
--lookup-attributes AttributeKey=EventName,AttributeValue=RunInstances \
--max-results 50 \
--output json |
jq -r '.Events[].CloudTrailEvent | fromjson
| select(.errorMessage != null)
| select(.errorMessage | test("service control policy|resource control policy"))
| [.eventTime, .eventSource, .eventName, .userIdentity.arn, .errorMessage]
| @tsv'Replace RunInstances with the action that failed. Four fields tell you most of what you need:
userIdentity.arnoruserIdentity.sessionContextshows which principal made the call, and in which account.eventNameandeventSourcegive the action.awsRegionis whataws:RequestedRegionwill contain. It is a common cause of Region-guardrail denials.errorCodeisAccessDeniedor a service-specific equivalent such asClient.UnauthorizedOperation.
List the policies that apply
An SCP or RCP applies to an account if it is attached to the account, to any parent OU, or to the root. The effective permission is the intersection across all of those levels. List them all by walking up from the account. Run this from the management account or from a delegated administrator.
#!/usr/bin/env bash
# Usage: ./list-guardrails.sh 111122223333
set -euo pipefail
target="$1"
while true; do
echo "== $target"
for type in SERVICE_CONTROL_POLICY RESOURCE_CONTROL_POLICY; do
aws organizations list-policies-for-target \
--target-id "$target" \
--filter "$type" \
--query 'Policies[].[Id,Name]' \
--output text
done
# Root IDs start with "r-"; stop after listing the root
[[ "$target" == r-* ]] && break
target=$(aws organizations list-parents \
--child-id "$target" \
--query 'Parents[0].Id' \
--output text)
doneRead each policy with aws organizations describe-policy --policy-id p-examplepolicyid. To find where a suspicious policy is attached, run aws organizations list-targets-for-policy --policy-id p-examplepolicyid.
Diagnose explicit denies
If the message says "explicit deny", find the statement that matches. Compare the failed request to each Deny statement in this order:
ActionorNotAction. ANotActiondeny matches everything except the listed actions, so it often catches actions you did not expect.Resource. SCPs usually use*, but a narrower ARN pattern can still match.Condition. Most surprising denials come from conditions that evaluate differently than the author expected.
These are the most frequent culprits.
- Region guardrails. The
aws:RequestedRegioncondition blocks any service not exempted inNotAction. A service you did not list that calls a global endpoint, such asus-east-1for some control-plane APIs, may be denied. CheckawsRegionin the CloudTrail event and compare it with your approved list. Add the service toNotActiononly if its requests are truly global. IfExistsoperators.BoolIfExistswithaws:SecureTransportset tofalsealso matches requests where the key is absent. This is the intended behavior in the TLS RCP, but it can deny requests you did not mean to catch.- Organization perimeter RCPs. A deny based on
aws:PrincipalOrgIDblocks every principal outside your organization. That includes approved vendors, partner accounts, and some AWS-managed integrations. Theaws:PrincipalIsAWSServiceexception covers service principals but not a vendor's IAM role. If a third party suddenly loses access after an RCP rollout, this is the first place to look. - Tag conditions. Denies that depend on
aws:PrincipalTagoraws:ResourceTagfail when a tag is missing, mis-cased, or not yet propagated. They can also fail when a role session does not carry the tag.
Diagnose missing allows
The "no service control policy allows" message means the request reached an SCP level with no matching Allow. SCPs need an allow at every level from the root to the account. Check the following:
- The AWS-managed
FullAWSAccesspolicy was detached from the root, an OU, or the account, and nothing replaced it. - An allow-list SCP was attached to a parent OU but its statements do not include the service you need.
- A new child OU or account inherited a parent that is more restrictive than you expected. Because the intersection is applied at every level, an allow in a child SCP cannot widen what a parent excludes.
Compare each level's allowed actions with the denied action. The fix is to add the action to the SCP at the level that lacks it. Adding it only at the account level does not help if a parent OU does not allow it as well.
Common mistakes in troubleshooting
- Editing the IAM policy to fix an SCP denial. Adding permissions to a role never overrides an SCP or RCP. If the message names one, change the guardrail or request an exception.
- Forgetting that a guardrail may be in another account. For an RCP denial, the policy follows the resource's account, not the caller's.
- Assuming a change is live immediately. SCP and RCP changes are eventually consistent. Wait a few minutes and retry before concluding that a fix failed.
- Ignoring other denial sources. Permission boundaries, session policies, VPC endpoint policies, and resource policies can also deny. Read the message wording carefully before blaming the organization.
Fixing the denial safely
Once you know which policy blocks the request, choose the smallest change that works.
- If the request is legitimate and the guardrail is correct, add a targeted exception. Use
ArnNotLikeonaws:PrincipalArnto exempt one role, or add the service toNotAction. - If the guardrail is too broad, narrow the
Action,Resource, orConditionrather than detaching the policy. - If the guardrail is correct and the request should not happen, fix the caller.
Test each change on a test OU first, as described in the rollout chapter. After the change, repeat the failed request and confirm in CloudTrail that the error is gone. Save the CloudTrail event ID with the change record so reviewers can see why the exception exists.
Exercise
A role in a member account gets "User ... is not authorized to perform: s3:GetObject on resource ... with an explicit deny in a resource control policy". The role's IAM policy allows s3:*. A colleague suggests adding a second Allow statement to the role's policy. Why will that not work, and where should you look instead?
Show answer
An RCP applies to the resource, and an explicit deny always wins over any allow in an identity-based policy. Adding an allow to the role has no effect. Look at the RCPs attached to the account that owns the bucket, or to its parent OUs and the root. Use list-policies-for-target while walking up the tree, then check the Deny statement's Action and Condition (for example an aws:PrincipalOrgID or aws:SecureTransport condition). Fix the RCP or add a narrow exception, then retest.
Exercise
A request to launch an EC2 instance in ap-southeast-2 fails with "because no service control policy allows the ec2:RunInstances action". The account sits in an OU with a Region-restriction deny SCP, and FullAWSAccess is still attached at every level. Is the Region SCP the likely cause? What would you check?
Show answer
No. A Region-restriction deny SCP produces an "explicit deny" message, not "no service control policy allows". The missing-allow message points to a level where no SCP allows the action, such as a detached FullAWSAccess or an allow-list SCP that omits EC2. The statement that FullAWSAccess is attached at every level should be verified with list-policies-for-target from the account up to the root, and each allow-list SCP checked for ec2:RunInstances.