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 condition denies all actions in non-us-east-1 regions.
- ✓
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 deny statement with condition StringNotEquals us-east-1 denies the action in us-west-2.
- ✗
The user can stop the instance because the first statement allows it.
Why it's wrong here
Deny statements override allow statements.
- ✗
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
The Deny statement explicitly denies the action, overriding the Allow.
Go deeper
Related to this question
About these practice questions
This SAP-C02 question is part of Courseiva's 1,660-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 →
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.