Question 1,413 of 1,750
Incident and Event ResponsemediumMultiple ChoiceObjective-mapped

How Explicit Deny Overrides Allow in IAM Policies

This DOP-C02 practice question tests your understanding of incident and event response. Match the stated requirement to the specific cloud service, access model, or configuration option — many options are valid in isolation but not for this scenario. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

Exhibit

Refer to the exhibit.
```
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "ec2:DescribeInstances",
        "ec2:StartInstances",
        "ec2:StopInstances"
      ],
      "Resource": "*"
    },
    {
      "Effect": "Deny",
      "Action": "ec2:TerminateInstances",
      "Resource": "arn:aws:ec2:us-east-1:123456789012:instance/*"
    }
  ]
}
```

An IAM policy attached to a DevOps engineer's role is shown above. The engineer is trying to restart a stopped EC2 instance in the us-east-1 region but receives an 'AccessDenied' error. The instance ID is i-0abcd1234efgh5678. What is the MOST likely reason?

Clue words in this question

Noticing these words before you look at the options changes how you read each choice.

  • Clue: "most likely"

    Why it matters: Probability qualifier — the question wants the most probable cause or outcome, not a guaranteed one. Eliminate low-probability options.

Exhibit

Refer to the exhibit.
```
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "ec2:DescribeInstances",
        "ec2:StartInstances",
        "ec2:StopInstances"
      ],
      "Resource": "*"
    },
    {
      "Effect": "Deny",
      "Action": "ec2:TerminateInstances",
      "Resource": "arn:aws:ec2:us-east-1:123456789012:instance/*"
    }
  ]
}
```

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

The policy does not allow ec2:StartInstances on the specific instance ARN.

The policy includes an Allow statement for ec2:StartInstances on all resources ("*") and a Deny statement for ec2:TerminateInstances on the specific instance ARN. Since explicit Deny is specific to the TerminateInstances action, it does not affect the StartInstances action. Therefore, the engineer should be able to start the instance based on the Allow statement. However, the engineer receives an AccessDenied error. The most likely reason is that the policy does not actually allow ec2:StartInstances on that particular instance ARN. This could occur if the Allow statement does not include the instance ARN (e.g., it only applies to other resources) or if there is a condition or boundary that prevents the allow from applying. Without an explicit allow on that specific instance, the implicit deny (default deny) applies, resulting in AccessDenied. Option B correctly identifies this: the policy does not allow ec2:StartInstances on the specific instance ARN.

Key principle: ACLs process entries top to bottom and stop at the first match. Entry order and interface direction matter as much as the permit or deny statement.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • The policy does not include a condition key that limits the allow to a specific region.

    Why it's wrong here

    Incorrect. The policy does not need a region condition to allow StartInstances; lacking one would allow all regions, not deny.

  • The policy does not allow ec2:StartInstances on the specific instance ARN.

    Why this is correct

    Correct. As explained, the allow likely does not cover this specific instance ARN, so the default deny applies.

    Clue confirmation

    The clue word "most likely" in the question point toward this answer.

    Related concept

    Standard ACLs match source addresses.

  • The Deny statement overrides the Allow statement for the instance.

    Why it's wrong here

    Incorrect. An explicit Deny on TerminateInstances does not override an Allow on StartInstances because IAM evaluates each action independently.

  • The policy's Deny statement is applied to all EC2 actions.

    Why it's wrong here

    Incorrect. The Deny statement is specifically for TerminateInstances, not all EC2 actions.

Common exam traps

Common exam trap: ACLs stop at the first match

ACLs are processed top to bottom. The first matching entry wins, and an implicit deny usually exists at the end.

Detailed technical explanation

How to think about this question

ACL questions test precision: source, destination, protocol, port and direction. A generally correct ACL can still fail if it is applied on the wrong interface or in the wrong direction.

KKey Concepts to Remember

  • Standard ACLs match source addresses.
  • Extended ACLs can match source, destination, protocol and ports.
  • The first matching ACL entry is used.
  • There is usually an implicit deny at the end.

TExam Day Tips

  • Check inbound versus outbound direction.
  • Read the ACL from top to bottom.
  • Look for a broader permit or deny above the intended line.

Key takeaway

ACLs process entries top to bottom and stop at the first match. Entry order and interface direction matter as much as the permit or deny statement.

Real-world example

How this comes up in practice

A company's IT admin needs to give a contractor read-only access to production logs without sharing account credentials. Using role-based access control (RBAC) and temporary scoped permissions — not a permanent shared password — is the correct pattern. Questions like this test whether you can apply least-privilege access across cloud identity services.

What to study next

Got this wrong? Here's your next step.

Review ACL processing order, placement rules (standard near destination, extended near source), and inbound vs outbound direction. Study wildcard masks and implicit deny. Then practise related DOP-C02 ACL questions on filtering logic and placement.

Related practice questions

Related DOP-C02 practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free DOP-C02 practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this DOP-C02 question test?

Incident and Event Response — This question tests Incident and Event Response — Standard ACLs match source addresses..

What is the correct answer to this question?

The correct answer is: The policy does not allow ec2:StartInstances on the specific instance ARN. — The policy includes an Allow statement for ec2:StartInstances on all resources ("*") and a Deny statement for ec2:TerminateInstances on the specific instance ARN. Since explicit Deny is specific to the TerminateInstances action, it does not affect the StartInstances action. Therefore, the engineer should be able to start the instance based on the Allow statement. However, the engineer receives an AccessDenied error. The most likely reason is that the policy does not actually allow ec2:StartInstances on that particular instance ARN. This could occur if the Allow statement does not include the instance ARN (e.g., it only applies to other resources) or if there is a condition or boundary that prevents the allow from applying. Without an explicit allow on that specific instance, the implicit deny (default deny) applies, resulting in AccessDenied. Option B correctly identifies this: the policy does not allow ec2:StartInstances on the specific instance ARN.

What should I do if I get this DOP-C02 question wrong?

Review ACL processing order, placement rules (standard near destination, extended near source), and inbound vs outbound direction. Study wildcard masks and implicit deny. Then practise related DOP-C02 ACL questions on filtering logic and placement.

Are there clue words in this question I should notice?

Yes — watch for: "most likely". Probability qualifier — the question wants the most probable cause or outcome, not a guaranteed one. Eliminate low-probability options.

What is the key concept behind this question?

Standard ACLs match source addresses.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

1 more ways this is tested on DOP-C02

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. A DevOps team applies the above IAM policy to a group. A developer in this group tries to upload an object to the S3 bucket using the AWS CLI without specifying any encryption. The upload fails with an AccessDenied error. Why does the upload fail?

hard
  • A.The Allow statement's condition is satisfied, but the Deny statement is evaluated first and denies the request.
  • B.The Allow statement requires encryption to be AES256, but the CLI defaults to SSE-S3, which is not AES256.
  • C.The Deny statement explicitly denies PutObject when encryption is not AES256, overriding the Allow.
  • D.The Deny statement's condition is not met because the request does not include encryption headers.

Why C: The correct answer is C. The Deny statement explicitly denies `s3:PutObject` when encryption is not AES256 (`StringNotEquals "AES256"`). Since the upload request does not specify any encryption, the condition is true, and the Deny applies, overriding any Allow. Option A is incorrect because the Allow statement's condition (requiring AES256) is not satisfied, so it does not grant permission; however, the failure is due to the explicit Deny, not because Deny is evaluated first. Option B is incorrect because the Allow condition is not met, and the CLI default (SSE-S3) is actually AES256, but the Deny still applies because no encryption headers are present. Option D is incorrect because the Deny condition is met (StringNotEquals AES256 is true when no encryption is specified).

Keep practising

More DOP-C02 practice questions

Last reviewed: Jun 20, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This DOP-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DOP-C02 exam.