# Explicit Deny Precedence

Explicit Deny Precedence is the authorization rule that a matching explicit denial overrides otherwise applicable permissions.

Cloud concept. Updated 2026-10-29. Page: https://blowstack.com/tools/cloud-concepts-hub/explicit-deny-precedence

> In a deny-overrides authorization model, a request fails whenever an applicable policy explicitly denies it, even if another policy allows it. This enables enforceable security guardrails, but troubleshooting requires identifying the denying statement and its evaluation context rather than simply adding permissions.

Practice exams covering Explicit Deny Precedence: [SOA-C03 AWS Certified CloudOps Engineer - Associate](https://blowstack.com/practice-exams/aws-certified-cloudops-engineer-associate), [DEA-C01 AWS Certified Data Engineer - Associate](https://blowstack.com/practice-exams/aws-certified-data-engineer-associate), [DOP-C02 AWS Certified DevOps Engineer - Professional](https://blowstack.com/practice-exams/aws-certified-devops-engineer-professional), [MLA-C02 (beta) AWS Certified Machine Learning Engineer - Associate](https://blowstack.com/practice-exams/aws-certified-machine-learning-engineer-associate), [SCS-C03 AWS Certified Security - Specialty](https://blowstack.com/practice-exams/aws-certified-security-specialty), [SAA-C03 AWS Certified Solutions Architect - Associate](https://blowstack.com/practice-exams/aws-certified-solutions-architect-associate), [SAP-C03 AWS Certified Solutions Architect - Professional](https://blowstack.com/practice-exams/aws-certified-solutions-architect-professional).

## 6 key aspects of Explicit Deny Precedence

Explicit deny precedence enforces security guardrails while making policy scope, request context, and the distinction between explicit and implicit denial central to troubleshooting.

1. **Deny overrides allow**: A matching explicit deny defeats an otherwise applicable allow within a deny-overrides authorization model. Adding administrator permissions does not bypass that denial.
2. **Explicit and implicit denial are different**: An implicit denial reflects missing authorization, while an explicit denial comes from an applicable deny statement. The distinction determines whether adding permission can resolve the failure.
3. **Request context determines applicability**: Evaluate the actual action, resource, caller, and condition values. A conditional deny may apply to one request but not another from the same principal.
4. **Guardrails span policy layers**: Identity policies, resource policies, and applicable organizational or endpoint controls can introduce explicit denies. Inspect all relevant layers rather than only the caller's attached policies.
5. **Allow evaluation remains context-dependent**: Removing an explicit deny does not automatically grant access. Required allows, permissions limits, cross-account requirements, and dependent operations must still be satisfied.
6. **Diagnostics require corroboration**: Use policy simulation, policy analysis, request evidence, and controlled tests together. A simulator result can differ from a live request when context or authorization layers are not represented.

## Cloud services for Explicit Deny Precedence

IAM defines principal permissions, while AWS Organizations establishes organizational permission limits and services such as S3 and KMS enforce resource-specific authorization. An applicable explicit deny in these authorization paths cannot be overcome by adding another allow. For investigation, CloudTrail helps identify the actual caller and failed operation, IAM Policy Simulator tests supported policy scenarios, and IAM Access Analyzer validates policies and examines supported access relationships. Engineers should correlate these results with live request context and inspect controls outside the simulation before concluding that access should succeed.

- **[AWS Organizations](https://blowstack.com/tools/cloud-services-hub/aws-organizations)**: Service control policies can explicitly deny actions for principals within their applicable organizational scope, including member-account root users. These policies set permission limits rather than granting access, and they do not restrict identities in the management account or service-linked roles.
- **[Amazon S3](https://blowstack.com/tools/cloud-services-hub/amazon-s3)**: S3 bucket policies can explicitly deny object operations even when identity policies allow them. Conditions such as transport security or network origin provide practical examples of request-dependent guardrails.
- **[AWS CloudTrail](https://blowstack.com/tools/cloud-services-hub/aws-cloudtrail)**: CloudTrail records supported API activity and can provide caller, action, resource, and error information for authorization investigations. Event availability depends on logging configuration and event support, and an event may not identify the exact denying statement.

## Explicit Deny Precedence exam questions

Real practice exam questions on Explicit Deny Precedence, with the correct answer and its explanation.

### Question 1 (MLA-C02 (beta))

**Question:**

An inference application uses an IAM role named FraudClient to invoke Amazon SageMaker AI real-time endpoints. During a blue/green deployment, requests to the existing endpoint succeed, but requests to the replacement endpoint return AccessDeniedException.

An ML engineer verifies the following:
• FraudClient's identity-based policy allows sagemaker:InvokeEndpoint on both endpoint ARNs.
• FraudClient has a permissions boundary that allows sagemaker:InvokeEndpoint on all resources but also explicitly denies that action when the resource is not the existing endpoint ARN, using NotResource.
• Both endpoints are healthy, and no other policies or network controls block the requests.

The application must invoke both endpoints during the transition, but it must not gain access to any other endpoint. Which change should the engineer make?

**Correct answer:** Update the permissions boundary's Deny statement so that its NotResource list contains both the existing and replacement endpoint ARNs.

**Explanation:** Listing both ARNs in NotResource makes the explicit deny inapplicable to those two endpoints while continuing to deny invocation of every other endpoint. The existing identity-based permissions and boundary Allow then permit invocation of both approved endpoints.

### Question 2 (SAP-C03)

**Question:**

A company stores audit records in a central Amazon S3 bucket. IAM roles in the company's AWS organization require direct access to the bucket. AWS CloudTrail also delivers records directly by using its service principal on behalf of trails in accounts 111122223333 and 444455556666. These integrations provide aws:SourceAccount in their S3 requests.

The bucket policy already denies requests when aws:PrincipalOrgID does not match the company's organization ID, with an exception when aws:PrincipalIsAWSService is true. Separate Allow statements grant the necessary IAM-role and CloudTrail permissions.

The security team must narrow the service-principal exception. Direct requests from AWS service principals must be denied unless aws:SourceAccount identifies one of the two approved accounts. Requests from service principals that omit this key must also be denied. The control must remain effective if additional Allow statements are added later and must not disrupt authorized IAM-role requests.

Which additional bucket-policy statement meets these requirements? Each proposed statement uses Effect Deny, Principal "*", Action "s3:*", and both the bucket ARN and its object ARN as Resource.

**Correct answer:** Use a Bool condition requiring aws:PrincipalIsAWSService to equal true and a StringNotEqualsIfExists condition requiring aws:SourceAccount not to equal either 111122223333 or 444455556666.

**Explanation:** The conditions are ANDed, so this Deny applies only to direct AWS service-principal requests whose source account is unapproved or absent. StringNotEqualsIfExists in a Deny also denies requests when the key is missing. Authorized IAM-role requests are unaffected because aws:PrincipalIsAWSService is false. The explicit Deny cannot be overridden by additional Allow statements.

### Question 3 (SOA-C03)

**Question:**

A CloudOps engineer must allow an IAM user to delete temporary CloudWatch Logs log groups whose names begin with /sandbox/, while continuing to prevent the user from deleting log groups whose names begin with /production/.

CloudTrail confirms that a failed DeleteLogGroup request used the expected IAM user. The user belongs to two IAM groups. One group's policy allows logs:DeleteLogGroup on /sandbox/ log groups. The other group's policy denies logs:DeleteLogGroup on all resources. An IAM policy simulation for a sandbox log group returns explicitDeny and identifies the second group's statement as a matching statement. No other policies or controls restrict the request.

Which change will meet the requirements?

**Correct answer:** Change the denying statement's resource scope from all resources to only the production log groups, retaining the existing Allow for sandbox log groups.

**Explanation:** Narrowing the Deny to production log groups makes it inapplicable to sandbox deletion requests. The existing Allow then authorizes sandbox deletions, while the explicit Deny continues to protect production log groups.

### Question 4 (SCS-C03)

**Question:**

A document-publishing application uses an IAM role to copy an object from s3://editorial-source/releases/report.pdf to s3://publications/releases/report.pdf by calling the Amazon S3 CopyObject API. Both buckets and the role are in the same AWS account. The request fails with AccessDenied.

A security engineer verifies the following:
• An inline role policy explicitly allows s3:GetObject on the exact source object ARN and s3:PutObject on the exact destination object ARN.
• A managed policy attached to the role contains this statement:
{"Effect":"Deny","Action":"s3:GetObject","Resource":"arn:aws:s3:::editorial-source/*","Condition":{"StringEquals":{"s3:ExistingObjectTag/PublicationStatus":"Hold"}}}
• The source object has PublicationStatus=Hold.
• A simulation that includes only the inline policy reports allowed for both required actions.
• Both buckets use SSE-S3 encryption and Bucket owner enforced Object Ownership. The copy does not specify a version ID, ACL, or object tags. Neither bucket has a bucket policy, and no other authorization controls restrict the request.

Which analysis correctly explains the failure?

**Correct answer:** The source read is explicitly denied when all attached role policies and the source tag context are evaluated. The destination write is allowed, but that permission cannot compensate for the denied source read.

**Explanation:** CopyObject requires s3:GetObject on the source and s3:PutObject on the destination. The managed policy's Deny matches the source action, object ARN, and existing object tag. It overrides the inline policy's Allow, even though that Allow names the exact object. Simulating only the inline policy omits the statement responsible for the failure.

### Question 5 (DEA-C01)

**Question:**

A company stores analytics backups in eu-west-1 by using AWS Backup. Its data residency policy permits recovery copies only in eu-west-1 and eu-central-1. An AWS Organizations SCP explicitly denies backup:CopyIntoBackupVault for backup vaults in us-west-2.

A data engineer runs a disaster recovery test that copies a recovery point to an existing vault in us-west-2. The copy fails, and the authorization details identify the SCP's explicit Deny statement. The job uses a regular IAM role, not a service-linked role. The role already has the required AWS Backup permissions. An existing vault in eu-central-1 has all required permissions and encryption configuration for the copy.

Which action will allow the recovery copy to succeed while preserving the company's residency guardrail?

**Correct answer:** Change the copy job's destination to the existing backup vault in eu-central-1.

**Explanation:** The eu-central-1 destination meets the residency policy and does not match the SCP's denial of copies into us-west-2 vaults. Because the required permissions and encryption configuration are already in place, changing the destination enables the copy without weakening the guardrail.

### Question 6 (DOP-C02)

**Question:**

A company uses AWS Organizations with all features enabled. All workload accounts are in a Workloads OU, and FullAWSAccess is attached at every level of the hierarchy. The Workloads OU also has this SCP:

{"Version":"2012-10-17","Statement":[{"Effect":"Deny","Action":"*","Resource":"*","Condition":{"StringNotEquals":{"aws:RequestedRegion":["eu-west-1","eu-central-1"]}}}]}

After the SCP is deployed, centralized automation can no longer manage IAM roles, Amazon Route 53 hosted zones, or Amazon CloudFront distributions in the workload accounts. These operations use global service endpoints, and their requests have aws:RequestedRegion set to us-east-1. The automation's IAM permissions already allow the operations, and no other authorization controls block them.

The security team approves an exception for all actions in these three global services. Requests to all other services must remain denied when aws:RequestedRegion is outside eu-west-1 and eu-central-1, including requests to services adopted in the future. Workload account administrators must not be able to override this restriction.

Which change should a DevOps engineer make?

**Correct answer:** Replace "Action":"*" in the deny statement with "NotAction":["iam:*","route53:*","cloudfront:*"]. Retain the existing Resource and Condition elements.

**Explanation:** NotAction excludes the three approved services from this deny. All other service actions, including newly adopted services, remain denied when the requested Region is outside the two approved Regions. The exception does not grant permissions; the automation still requires its existing IAM permissions. Because the restriction is an inherited SCP, workload account administrators cannot override it with IAM policies.

### Question 7 (SAA-C03)

**Question:**

A company uses an Amazon SQS queue in one AWS account. The queue's resource policy contains a statement that denies sqs:SendMessage to all principals when aws:PrincipalArn does not equal the ARN of OriginalProducerRole. This policy prevents other roles from sending messages even if their identity-based policies allow it.

The company introduces ReplacementProducerRole. Its identity-based policy allows sqs:SendMessage on this queue, but its requests receive AccessDenied errors. Both producer roles must be able to send messages during the migration. All other roles must remain unable to send messages, including several roles that already have broad SQS permissions. No other policies restrict these requests.

Which change meets these requirements?

**Correct answer:** Update the existing Deny statement's StringNotEquals condition so that aws:PrincipalArn is compared against a list containing both producer role ARNs.

**Explanation:** With both ARNs in the StringNotEquals list, the deny applies only when the principal ARN matches neither producer role. The producers' existing identity-based permissions authorize sending within the same account, while the explicit deny continues to block every other role despite any identity-based allows.

## Practice Explicit Deny Precedence in a full exam

Questions on Explicit Deny Precedence in each practice exam, with every answer option and an explanation for each:

- [SAP-C03](https://blowstack.com/practice-exams/aws-certified-solutions-architect-professional): 6 questions
- [SCS-C03](https://blowstack.com/practice-exams/aws-certified-security-specialty): 6 questions
- [DEA-C01](https://blowstack.com/practice-exams/aws-certified-data-engineer-associate): 6 questions
- [DOP-C02](https://blowstack.com/practice-exams/aws-certified-devops-engineer-professional): 6 questions
- [SOA-C03](https://blowstack.com/practice-exams/aws-certified-cloudops-engineer-associate): 4 questions
- [SAA-C03](https://blowstack.com/practice-exams/aws-certified-solutions-architect-associate): 3 questions
- [MLA-C02 (beta)](https://blowstack.com/practice-exams/aws-certified-machine-learning-engineer-associate): 2 questions

## What is Explicit Deny Precedence

Explicit deny precedence resolves conflicts between authorization policies: if an applicable statement explicitly denies a request, an allow elsewhere cannot authorize that request. This principle is common in cloud identity and resource-policy systems, including AWS IAM authorization. It is not a universal rule for every cloud control; ordered network rules, application permissions, and other authorization engines may use different evaluation models.

An explicit denial differs from an implicit denial. An explicit denial comes from a matching deny statement. An implicit denial means the required permission is absent from the applicable authorization path. Adding a suitable allow can resolve a missing permission, provided all other requirements are met. Adding an allow does not resolve an explicit denial; the denying statement must stop applying, or the request must change to satisfy its conditions.

Policy applicability is essential. A deny matters only when its action, resource, principal where specified, and conditions match the request. In AWS IAM policy evaluation, a more specific allow does not override a broader matching deny, and statement order does not determine precedence. Administrators must evaluate the actual principal or assumed-role session, requested API action, resource identifier, and condition values rather than judging policy names or attached permissions alone.

For example, an engineer's role might allow s3:GetObject while a bucket policy denies that action when aws:SecureTransport is false. An HTTP request is denied despite the role's allow. Using HTTPS makes that particular denial inapplicable, but the request still needs an otherwise valid authorization path. Similarly, a service control policy that explicitly denies an action can block principals in affected AWS Organizations member accounts even when they have AdministratorAccess. Service control policies do not grant permissions, and their scope and documented exceptions must be considered.

AWS authorization can involve identity policies, resource policies, permissions boundaries, session policies, organization policies, and endpoint policies. Applicable explicit denies take precedence, but effective permissions are not calculated by simply combining every allow. Boundaries and session policies limit permissions, and resource-based grants have principal-specific evaluation rules. Cross-account access commonly requires authorization on both sides. Also, a failed operation may require permissions for several actions: reading an encrypted object can require both object access and permission to decrypt its encryption key.

To troubleshoot, capture the failed API action, resource, caller identity, session details, and relevant request context. Inspect available access-denied details and CloudTrail events, recognizing that coverage and diagnostic detail vary. Use IAM Policy Simulator to test supported policy combinations and supply the necessary condition context. Simulation has limitations and does not automatically reproduce every live authorization layer; an allowed simulation is not proof that the real request will succeed. IAM Access Analyzer complements this process through policy validation and supported access analysis, rather than serving as a complete runtime authorization trace.

Explicit denies provide durable guardrails against accidental permission expansion, but broad conditions can disrupt workloads and emergency access. Missing condition keys, negated operators, and exceptions for service principals deserve careful testing. Prefer narrowly scoped, documented denials, test expected permitted and prohibited requests, and correct the actual denying control instead of attaching increasingly broad allow policies.

## Learn Explicit Deny Precedence in lessons

7 short lessons on Explicit Deny Precedence in 7 certification courses.

- MLA-C02 (beta): Explicit Deny Precedence: tracing an overriding denial (Premium), https://app.blowstack.com/lessons/explicit-deny-precedence-tracing-an-overriding-denial-mla-c02
- SAP-C03: Explicit Deny Precedence: conditional data perimeter guardrails (Premium), https://app.blowstack.com/lessons/explicit-deny-precedence-conditional-data-perimeter-guardrails-sap-c03
- SOA-C03: Explicit Deny Precedence: tracing applicable denies (Premium), https://app.blowstack.com/lessons/explicit-deny-precedence-tracing-applicable-denies-soa-c03
- SCS-C03: Explicit Deny Precedence: tracing applicable denials (Premium), https://app.blowstack.com/lessons/explicit-deny-precedence-tracing-applicable-denials-scs-c03
- DEA-C01: Explicit Deny Precedence: matching denials across policy layers (Premium), https://app.blowstack.com/lessons/explicit-deny-precedence-matching-denials-across-policy-layers-dea-c01
- DOP-C02: Explicit Deny Precedence: SCP guardrails (Premium), https://app.blowstack.com/lessons/explicit-deny-precedence-scp-guardrails-dop-c02
