DVA-C02 Security Practice Question
Exhibit
Refer to the exhibit.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ec2:RunInstances",
"ec2:DescribeInstances"
],
"Resource": "*"
},
{
"Effect": "Deny",
"Action": "ec2:RunInstances",
"Resource": "arn:aws:ec2:*:*:instance/*",
"Condition": {
"StringNotEquals": {
"ec2:InstanceType": "t2.micro"
}
}
}
]
}A developer attaches the following IAM policy:
```json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "ec2:RunInstances",
"Resource": "*"
},
{
"Effect": "Deny",
"Action": "ec2:RunInstances",
"Resource": "*",
"Condition": {
"StringNotEquals": {"ec2:InstanceType": "t2.micro"
}
}
}
]
}```
What happens when the developer attempts to launch a t2.micro 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 action is allowed because the Allow statement applies and the Deny condition excludes t2.micro.
The question implies an IAM policy with an Allow statement for ec2:RunInstances and a Deny statement that uses a condition (e.g., ec2:InstanceType StringNotEquals t2.micro) to block instances that are not t2.micro. Since the condition in the Deny only matches non-t2.micro instances, the Deny does not apply to t2.micro. Therefore, the Allow takes effect and launching a t2.micro instance is allowed.
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 action is denied because ec2:RunInstances requires additional permissions.
Why it's wrong here
Incorrect. The ec2:RunInstances permission is the core authorization required to launch an instance; while resource-level permissions and dependent actions like creating tags or attaching volumes may be needed for certain request parameters, these are not a blanket requirement and do not constitute a denial in this policy. The perceived need for additional permissions is separate from the Allow/Deny evaluation; the outcome here is governed solely by the existing Allow and the non-applicable Deny condition.
- ✓
The action is allowed because the Allow statement applies and the Deny condition excludes t2.micro.
Why this is correct
Correct. In IAM, a request is implicitly denied if no Allow matches, but here the Allow for ec2:RunInstances matches the action and applies to the principal. The Deny statement includes a condition that evaluates to false for t2.micro, so it does not apply. Because there is no applicable Deny and at least one applicable Allow, the launch proceeds successfully.
- ✗
The action is denied because the Deny statement overrides the Allow.
Why it's wrong here
Incorrect. While IAM's explicit Deny does override any Allow, that precedence only applies when the Deny statement's conditions are satisfied. In this policy, the Deny is conditional on an instance type that does not match t2.micro, so the Deny never becomes an applicable statement for this request. Since the Deny is not triggered, the Allow remains effective and the action is permitted.
- ✗
The action is allowed only if the user has ec2:DescribeInstances as well.
Why it's wrong here
Incorrect. ec2:DescribeInstances is a read-only API call and is not a dependency for ec2:RunInstances; IAM actions do not have a prerequisite chain. To launch an instance, the only relevant authorization is the Allow statement for RunInstances (provided no Deny applies). Without DescribeInstances, the user can still run instances but would not be able to list or view them afterwards—so it is irrelevant to whether the launch itself is allowed.
Go deeper
Related to this question
About these practice questions
This DVA-C02 question is part of Courseiva's 724-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 DVA-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 DVA-C02 exam.