ANS-C01 Network Security, Compliance and Governance Practice Question
Exhibit
Refer to the exhibit.
Exhibit (IAM Policy JSON):
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ec2:DescribeSecurityGroups",
"ec2:AuthorizeSecurityGroupIngress",
"ec2:RevokeSecurityGroupIngress"
],
"Resource": "*",
"Condition": {
"IpAddress": {
"aws:SourceIp": "203.0.113.0/24"
}
}
},
{
"Effect": "Deny",
"Action": "ec2:AuthorizeSecurityGroupIngress",
"Resource": "*",
"Condition": {
"StringEquals": {
"ec2:AuthorizeSecurityGroupIngress": "0.0.0.0/0"
}
}
}
]
}A security team has attached the above IAM policy to a user. The user tries to add an inbound rule to a security group that allows traffic from 0.0.0.0/0. The request is denied. However, the user is able to add a rule allowing traffic from 203.0.113.10. Which statement explains this behavior?
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 Deny statement only denies the action when the CIDR is 0.0.0.0/0, which overrides the Allow for that specific case. For other CIDRs, the Allow applies because the user's source IP is within the allowed range.
The Deny statement denies the ec2:AuthorizeSecurityGroupIngress action only when the condition is satisfied—specifically, when the CIDR being added is 0.0.0.0/0. The Allow statement permits the action when the user's source IP falls within 203.0.113.0/24. Since the user's IP is 203.0.113.10, the Allow applies. However, the Deny overrides the Allow for the specific case of 0.0.0.0/0. For other CIDRs, such as 203.0.113.10, the Deny condition is not met, so the Allow takes effect. Option A is incorrect because the condition key is valid; Option B is incorrect because the Deny does not block all ingress actions; Option C is incorrect because the Allow is not unconditional—it depends on the user's source IP.
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 incorrectly uses the condition ec2:AuthorizeSecurityGroupIngress, which is not a valid condition key, so the Deny is ignored.
Why it's wrong here
The condition key is valid; it uses the action name as a string condition key for the CIDR parameter.
- ✗
The Deny statement denies all ec2:AuthorizeSecurityGroupIngress actions, so the user cannot add any inbound rules.
Why it's wrong here
The Deny only denies when the CIDR is 0.0.0.0/0, not all ingress.
- ✗
The Allow statement allows all ec2:AuthorizeSecurityGroupIngress actions from IPs in 203.0.113.0/24, so the user can add any rule.
Why it's wrong here
The Deny overrides the Allow for the specific case of 0.0.0.0/0.
- ✓
The Deny statement only denies the action when the CIDR is 0.0.0.0/0, which overrides the Allow for that specific case. For other CIDRs, the Allow applies because the user's source IP is within the allowed range.
Why this is correct
The Deny is conditional on the CIDR being 0.0.0.0/0; other CIDRs are not denied, so the Allow statement permits the action.
Visual reference
Go deeper
Related to this question
About these practice questions
This ANS-C01 question is part of Courseiva's 1,621-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 →
Same concept, more angles
1 more way this is tested on ANS-C01
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 security engineer attaches the above IAM policy to an IAM user. The user then attempts to launch an EC2 instance from an IP address outside the 10.0.0.0/8 range. What will happen?
hard- A.The request will be allowed because the policy allows ec2:* on all resources.
- ✓ B.The request will be denied because the condition is not satisfied.
- C.The request will be denied because the policy does not include a Deny statement.
- D.The request will be allowed because the condition evaluates to true.
Why B: The policy allows ec2:* only when the source IP is within 10.0.0.0/8. If the user is coming from outside that range, the condition is not met, so the action is not allowed. The default is implicit deny, so the request will be denied. Option B is correct. Option A is wrong because the condition is not met. Option C is wrong because the policy does not deny explicitly; it just doesn't allow. Option D is wrong because the condition evaluates to false.
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This ANS-C01 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 ANS-C01 exam.