Cloud concept · Updated

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

In short

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.

Cloud Concepts Hub →

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.

01
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.

02
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.

03
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.

04
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.

05
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.

06
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 OrganizationsAWS 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 S3Amazon 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 CloudTrailAWS 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. Answer them with every option in the exam simulator.

MLA-C02 (beta)

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?

Show answerCORRECT ANSWER

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

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.

SAP-C03

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.

Show answerCORRECT 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.

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.

SOA-C03

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?

Show answerCORRECT 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.

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.

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:

Start a free practice exam

What is Explicit Deny Precedence

3 min read

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.

and 1 more lesson

Open the lessons