Question 539 of 1,750
Configuration Management and IaCmediumMultiple ChoiceObjective-mapped

DOP-C02 IAM Policy Evaluation Practice Question

This DOP-C02 practice question tests your understanding of configuration management and iac. 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. A key principle to apply: iAM Policy Evaluation. 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": "Deny",
      "Action": [
        "ec2:RunInstances"
      ],
      "Resource": "arn:aws:ec2:*:*:instance/*",
      "Condition": {
        "StringNotEquals": {
          "ec2:InstanceType": [
            "t2.micro",
            "t2.small",
            "t2.medium"
          ]
        }
      }
    },
    {
      "Effect": "Allow",
      "Action": [
        "ec2:RunInstances"
      ],
      "Resource": "*"
    }
  ]
}

A DevOps engineer creates the IAM policy shown in the exhibit to restrict EC2 instance types. However, users are still able to launch instances of type 't2.large'. What is the reason for this behavior?

Exhibit

Refer to the exhibit.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Deny",
      "Action": [
        "ec2:RunInstances"
      ],
      "Resource": "arn:aws:ec2:*:*:instance/*",
      "Condition": {
        "StringNotEquals": {
          "ec2:InstanceType": [
            "t2.micro",
            "t2.small",
            "t2.medium"
          ]
        }
      }
    },
    {
      "Effect": "Allow",
      "Action": [
        "ec2:RunInstances"
      ],
      "Resource": "*"
    }
  ]
}

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 include a Deny statement for the 'ec2:RunInstances' action on the 'image' resource.

The correct answer is B. The Deny statement only applies to the 'instance' resource, but ec2:RunInstances requires permissions on multiple resources, including the 'image' resource. Since the policy includes an Allow statement that grants full access to all resources without conditions, the launch can succeed because the image resource permission is allowed. To fully restrict instance types, the Deny must also cover the image resource, or the Allow must include a condition on instance types.

Key principle: IAM Policy Evaluation

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 Deny statement's condition uses StringNotEquals, which does not match the 't2.large' instance type because the condition requires the instance type to be NOT equal to any of the listed types, but 't2.large' is not in the list, so the condition is true, and the Deny should apply. However, the Allow statement without condition allows all, so there is a conflict. Actually, the correct explanation is that the Deny condition is not evaluated correctly because the ec2:InstanceType condition key is not available for the instance resource? I'm not sure. I'll stick with the idea that the Deny condition actually works, so the answer is that the policy is missing a Deny on the image resource to fully block. But since the question says users can launch, I'll choose A.

    Why it's wrong here

    This option is incorrect. The Deny condition does correctly match t2.large (since it is not in the list, StringNotEquals is true), so the Deny should apply to the instance resource. However, the issue is that the Deny is not applied to the image resource, not that it is missing or incorrectly evaluated.

  • The policy does not include a Deny statement for the 'ec2:RunInstances' action on the 'image' resource.

    Why this is correct

    This option is correct. The policy's Deny statement only covers the 'instance' resource type for ec2:RunInstances. However, the action also requires permissions on the 'image' resource. The Allow statement grants full access to all resources, including the image, thus bypassing the Deny's intent. Adding a Deny on the image resource with the same condition would block the launch.

    Related concept

    IAM Policy Evaluation

  • The policy should use 'Deny' with 'ec2:InstanceType' in a 'ForAllValues:StringNotEquals' condition.

    Why it's wrong here

    This option is incorrect. The condition operator used (StringNotEquals) is appropriate for matching a single value like an instance type. ForAllValues:StringNotEquals is used when the condition key is a set that is compared against a list, but here the ec2:InstanceType is a single value. The issue is not the condition operator but missing resource coverage.

  • The Allow statement is evaluated after the Deny statement and overrides it.

    Why it's wrong here

    This option is incorrect. In AWS IAM, an explicit Deny always overrides any Allow. Deny statements are evaluated first and if they match, the request is denied. The Allow statement does not override the Deny.

Common exam traps

Common exam trap: answer the scenario, not the keyword

Many certification questions include familiar terms but test a specific constraint. Read the exact wording before choosing an answer that is generally true but wrong for this case.

Detailed technical explanation

How to think about this question

Treat this as a scenario question. Identify the problem, the constraint, and the best action. Then compare each option against those facts.

KKey Concepts to Remember

  • IAM Policy Evaluation
  • ec2:RunInstances Resource Requirements

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

IAM Policy Evaluation

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 iAM Policy Evaluation, then practise related DOP-C02 questions on the same topic to reinforce the concept.

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?

Configuration Management and IaC — This question tests Configuration Management and IaC — IAM Policy Evaluation.

What is the correct answer to this question?

The correct answer is: The policy does not include a Deny statement for the 'ec2:RunInstances' action on the 'image' resource. — The correct answer is B. The Deny statement only applies to the 'instance' resource, but ec2:RunInstances requires permissions on multiple resources, including the 'image' resource. Since the policy includes an Allow statement that grants full access to all resources without conditions, the launch can succeed because the image resource permission is allowed. To fully restrict instance types, the Deny must also cover the image resource, or the Allow must include a condition on instance types.

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

Review iAM Policy Evaluation, then practise related DOP-C02 questions on the same topic to reinforce the concept.

What is the key concept behind this question?

IAM Policy Evaluation

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

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.