Courseiva
Question 1,112 of 247
Security and CompliancemediumMultiple ChoiceObjective-mapped

IAM Policy Evaluation with IP Condition and Deny

Exhibit

Refer to the exhibit.

Consider the following IAM policy:
```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "s3:GetObject",
      "Resource": "arn:aws:s3:::my-bucket/*",
      "Condition": {
        "IpAddress": {
          "aws:SourceIp": "192.0.2.0/24"
        }
      }
    },
    {
      "Effect": "Deny",
      "Action": "s3:GetObject",
      "Resource": "arn:aws:s3:::my-bucket/*",
      "Condition": {
        "NotIpAddress": {
          "aws:SourceIp": "192.0.2.0/24"
        }
      }
    }
  ]
}
```

Refer to the exhibit. An IAM user has this policy attached. What is the effect when the user attempts to get an object from my-bucket from an IP address in the range 198.51.100.0/24?

Quick Answer

The answer is denied because the explicit Deny statement applies and overrides any Allow. In AWS IAM policy evaluation with IP condition and explicit deny, an Allow statement can grant access only from a specific IP range, but a Deny statement using NotIpAddress will block any request that does not match that range. Since the request originates from 198.51.100.0/24, which falls outside the allowed 192.0.2.0/24 range, the Deny takes precedence—IAM always evaluates explicit Deny rules first, making them unconditional. On the AWS Certified SysOps Administrator Associate SOA-C02 exam, this scenario tests your understanding of the order of evaluation: explicit Deny overrides any Allow, even if the Allow’s condition is not met. A common trap is assuming a missing Allow automatically means Deny, but here the Deny is explicit, not implicit. Memory tip: “Deny is the final word—if it says no, no Allow can say yes.”

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

Denied because the Deny statement applies

The policy includes an Allow statement that grants s3:GetObject only from the IP range 192.0.2.0/24. It also includes a Deny statement that denies s3:GetObject from any IP address not in that range (using the NotIpAddress condition). The user's request comes from an IP in the 198.51.100.0/24 range, which is not included in the allowed range. Therefore, the Deny condition matches, and the Deny statement applies. In AWS IAM, an explicit Deny overrides any Allow, so the request is denied. Option D is correct. Option A is incorrect because the Deny does match. Option B is incorrect because there is an explicit Allow for a different IP range, but the Deny overrides it. Option C is incorrect because the Allow only applies to the specified range, and the Deny overrides it.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Allowed because the Deny condition does not match

    Why it's wrong here

    The Deny condition does match because the IP is not in the allowed range.

  • Denied because there is no explicit Allow for that IP range

    Why it's wrong here

    There is an explicit Deny.

  • Allowed because there is an Allow statement

    Why it's wrong here

    The Deny overrides the Allow.

  • Denied because the Deny statement applies

    Why this is correct

    The Deny statement explicitly denies access from IPs not in the range.

Quick reference

AWS S3 Storage Class Comparison

Storage ClassMin DurationRetrievalUse Case
S3 StandardNoneImmediateFrequently accessed data
S3 Standard-IA30 daysImmediateInfrequent access, rapid retrieval
S3 One Zone-IA30 daysImmediateNon-critical infrequent data
S3 Intelligent-TieringNoneImmediate–hoursUnknown or changing access patterns
S3 Glacier Instant90 daysMillisecondsArchive with instant retrieval
S3 Glacier Flexible90 daysMinutes–hoursArchive, flexible retrieval
S3 Glacier Deep Archive180 daysHoursLong-term compliance archive

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

2 more ways this is tested on SOA-C02

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. Refer to the exhibit. An IAM policy is attached to a user. What is the effective permission regarding the s3:DeleteObject action on the example-bucket?

easy
  • A.Denied because of the explicit Deny statement
  • B.Denied because the action is not allowed explicitly
  • C.Allowed because the Allow statement is listed first
  • D.Allowed because the Deny statement has a typo

Why A: In IAM, an explicit Deny overrides any Allow. The first statement allows all S3 actions, but the second statement explicitly denies s3:DeleteObject. Therefore, the effective permission is Deny. Option A is correct because the explicit Deny takes precedence. Options B, C, and D are incorrect: B since an explicit Deny is present, it is not simply 'not allowed'; C because the order of statements does not matter; D because the Deny statement is valid despite the typo.

Variation 2. Refer to the exhibit. An IAM user has this policy attached. The user tries to start an EC2 instance that has no tags. What will happen?

medium
  • A.The user will be allowed because the condition only applies if the tag exists
  • B.The user will be allowed because the resource ARN includes a wildcard
  • C.The user will be allowed because the policy does not explicitly deny the action
  • D.The user will be denied because the instance does not have the required tag

Why D: The IAM policy includes a condition that requires the EC2 instance to have a tag with key 'Environment' and value 'Production'. When the instance has no tags, the condition evaluates to false, and the default behavior for IAM policies is to deny access when a condition is not met. Since the policy does not explicitly allow the action without the tag, the request is implicitly denied.

Last reviewed: Jun 20, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

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