Courseiva
Design for New Solutions →hardMultiple Choice

SAP-C02 Design for New Solutions Practice Question

Exhibit

Refer to the exhibit.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "ec2:DescribeInstances",
        "ec2:StartInstances",
        "ec2:StopInstances"
      ],
      "Resource": "*"
    },
    {
      "Effect": "Deny",
      "Action": "*",
      "Resource": "*",
      "Condition": {
        "StringNotEquals": {
          "aws:RequestedRegion": "us-east-1"
        }
      }
    }
  ]
}

A company has an IAM policy attached to a user as shown in the exhibit. The user is trying to stop an EC2 instance in the us-west-2 region. What will happen?

⚠ Common exam trap

Many candidates assume an unconditional Allow always wins, but they forget that an explicit Deny with a condition that matches the request will override that Allow, leading them to incorrectly choose Option D.

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 user cannot stop the instance because the second statement denies all actions in regions other than us-east-1.

IAM policy evaluation follows an explicit deny model: any explicit deny overrides any allow. The second statement uses a `Deny` effect with a `StringNotEquals` condition on `aws:RequestedRegion`, which denies all actions (including ec2:StopInstances) when the request region is NOT us-east-1. Since the user is attempting to stop an EC2 instance in us-west-2, the condition evaluates to true, and the deny applies, blocking the action regardless of the first statement's allow.

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 user cannot stop the instance because the condition checks the request region.

    Why it's wrong here

    The deny's condition does check the request region, but the outcome depends on whether us-west-2 matches it; stating the mechanism without resolving the condition leaves the conclusion unsupported. Region-based conditions are tempting because they genuinely restrict access, and would be decisive if the condition excluded us-west-2.

  • ✓

    The user cannot stop the instance because the second statement denies all actions in regions other than us-east-1.

    Why this is correct

    The second statement's explicit Deny overrides the first statement's Allow, since an explicit deny always wins in IAM policy evaluation. Because the condition restricts permitted actions to us-east-1, the stop request in us-west-2 falls outside that scope and is blocked by the deny.

  • ✗

    The user can stop the instance because the first statement allows it.

    Why it's wrong here

    An explicit Deny in any statement overrides every Allow in the policy, so the first statement's permission cannot take effect. Reading statements in order is tempting because sequential evaluation is intuitive, but IAM evaluates all statements together, and the deny wins regardless of position.

  • ✗

    The user can stop the instance because the condition applies only to the Deny statement, but the Allow statement is unconditional.

    Why it's wrong here

    Conditions attach to the statement they appear in; a Deny statement's condition restricts only that deny, and the unconditional Allow still cannot override an explicit Deny. Treating conditions as scoped to one statement is tempting because it sounds precise, yet explicit deny always wins.

About these practice questions

This SAP-C02 question is part of Courseiva's 984-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This SAP-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 SAP-C02 exam.