Courseiva

DVA-C02 Development with AWS Services Practice Question

Exhibit

Refer to the exhibit.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "s3:GetObject",
        "s3:PutObject"
      ],
      "Resource": "arn:aws:s3:::example-bucket/*"
    },
    {
      "Effect": "Deny",
      "Action": "s3:*",
      "Resource": "arn:aws:s3:::example-bucket/secret/*"
    }
  ]
}

Refer to the exhibit. An IAM policy is attached to a user. What is the effect when the user tries to upload an object to s3://example-bucket/secret/file.txt?

⚠ Common exam trap

A common mix-up: candidates assume an Allow statement will always grant access, forgetting that an explicit Deny in IAM policies takes precedence over any Allow, even if the Deny is more specific.

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 upload fails because the Deny statement explicitly denies access to the secret/ prefix.

The Deny statement in the IAM policy explicitly denies the s3:PutObject action for any object with the prefix secret/ in the example-bucket. Since the user is trying to upload to s3://example-bucket/secret/file.txt, which matches the Deny condition, the request is denied regardless of any Allow statements. AWS IAM policy evaluation is explicit deny by default, meaning a Deny always overrides an 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 upload fails because the Deny statement explicitly denies access to the secret/ prefix.

    Why this is correct

    The IAM policy evaluation logic dictates that an explicit Deny statement always takes precedence over any Allow statement. In this scenario, the Deny statement explicitly targets resources within the `secret/` prefix of `my-bucket` using `arn:aws:s3:::my-bucket/secret/*` and applies to all S3 actions (`s3:*`). Therefore, any attempt to upload an object to this specific prefix will be explicitly denied, regardless of other Allow permissions.

  • ✗

    The upload fails only if the user is not the bucket owner.

    Why it's wrong here

    Bucket ownership in Amazon S3 primarily grants the owner full control over the object and bucket configuration, including the ability to modify bucket policies or ACLs. However, when an IAM policy is attached to a user, that policy's explicit permissions are evaluated independently of who owns the bucket. An explicit Deny within an IAM policy will prevent the action, irrespective of the user's relationship to the bucket's ownership.

  • ✗

    The upload succeeds because the Deny statement does not match the specific action.

    Why it's wrong here

    The Deny statement in the IAM policy explicitly specifies `s3:*` as its `Action`. This wildcard character signifies that the denial applies to *all* Amazon S3 actions, which inherently includes `s3:PutObject`, the action required for uploading an object. Therefore, the Deny statement unequivocally matches the specific action being attempted, making the premise of this option incorrect.

  • ✗

    The upload succeeds because the Allow statement grants s3:PutObject on the bucket.

    Why it's wrong here

    While an Allow statement granting `s3:PutObject` on `arn:aws:s3:::my-bucket/*` might exist, the fundamental principle of AWS IAM policy evaluation is that an explicit Deny always overrides an explicit Allow. If any policy contains an explicit Deny that matches the requested action and resource, access is immediately denied, even if other policies or statements would otherwise grant permission. This hierarchy ensures strict control over sensitive resources.

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

One of 1,135 original DVA-C02 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

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.