DOP-C02 Security and Compliance Practice Question
Exhibit
Refer to the exhibit.
```
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::my-public-bucket/*"
},
{
"Effect": "Deny",
"Principal": "*",
"Action": "s3:*",
"Resource": "arn:aws:s3:::my-public-bucket/*",
"Condition": {
"StringNotEquals": {
"aws:SourceIp": "192.0.2.0/24"
}
}
}
]
}
```An S3 bucket has the above bucket policy. What is the net effect on GetObject requests?
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
✓
Only requests from IP range 192.0.2.0/24 are allowed
The Allow statement grants public read access. The Deny statement denies all S3 actions when the source IP is not in 192.0.2.0/24. Since a Deny overrides an Allow, only requests from within that IP range are allowed. Option C is correct.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
All anonymous users can read objects
Why it's wrong here
The policy's Allow statement uses Principal "*", which includes anonymous users, but the accompanying Deny statement with Condition {NotIpAddress: {aws:SourceIp: "192.0.2.0/24"}} blocks every request that does not originate from that CIDR. Because an explicit deny overrides any allow, anonymous clients outside the range are rejected. Therefore the statement 'all anonymous users can read objects' is false; only anonymous visitors whose IP falls inside the range can access objects.
- ✗
All requests are denied
Why it's wrong here
Not all requests are denied. A request arriving from an IP address within 192.0.2.0/24 will match the Allow statement and will not satisfy the NotIpAddress condition on the Deny statement, so the Deny does not apply. Since the explicit deny only targets source IPs outside the allowed range, requests from the specified CIDR are permitted. Thus the bucket policy grants access to that restricted set rather than blocking everything.
- ✓
Only requests from IP range 192.0.2.0/24 are allowed
Why this is correct
The net effective policy is that only clients with source IP addresses in 192.0.2.0/24 are permitted to read objects. The Allow statement grants s3:GetObject to Principal "*", but the Deny statement with NotIpAddress of that range blocks all other source IPs; because explicit deny overrides allow, the condition on the deny becomes the controlling factor. This creates a whitelist: any request not coming from 192.0.2.0/24, even an authenticated AWS identity, is denied, while any request from that range, including anonymous users, is allowed.
- ✗
Only authenticated users can read objects
Why it's wrong here
The policy does not evaluate authentication or IAM identity; its condition is solely based on aws:SourceIp. Because Principal "*" explicitly includes unauthenticated users and no condition such as aws:userid or aws:username is present, an anonymous request from 192.0.2.0/24 would be allowed just like an authenticated one. Therefore saying 'only authenticated users can read objects' is incorrect—the discriminator is the source IP range, not AWS credentials.
Quick reference
AWS S3 Storage Class Comparison
| Storage Class | Min Duration | Retrieval | Use Case |
|---|---|---|---|
| S3 Standard | None | Immediate | Frequently accessed data |
| S3 Standard-IA | 30 days | Immediate | Infrequent access, rapid retrieval |
| S3 One Zone-IA | 30 days | Immediate | Non-critical infrequent data |
| S3 Intelligent-Tiering | None | Immediate–hours | Unknown or changing access patterns |
| S3 Glacier Instant | 90 days | Milliseconds | Archive with instant retrieval |
| S3 Glacier Flexible | 90 days | Minutes–hours | Archive, flexible retrieval |
| S3 Glacier Deep Archive | 180 days | Hours | Long-term compliance archive |
Go deeper
Related to this question
About these practice questions
Courseiva writes every DOP-C02 question from scratch — 1,487 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or 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 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.