Courseiva
Data Security and GovernancehardMultiple ChoiceObjective-mapped

Why S3 Bucket Policy Deny Overrides IAM Allow: A Troubleshooting Guide

A company runs a data lake on Amazon S3 with AWS Glue and Amazon Athena. The security team recently ran a report using Amazon Macie and found that multiple S3 objects containing PII are publicly accessible. The data engineer is tasked with remediating this issue immediately. The S3 bucket is configured with a bucket policy that grants public read access to all objects. The data engineer needs to ensure that no objects are publicly accessible while maintaining the ability for authorized IAM users and roles to access the data via Athena. The bucket must also remain accessible to the Glue crawler. What is the MOST effective course of action?

Quick Answer

The answer is to remove the bucket policy granting public access and attach an IAM policy to the Glue and Athena roles. This is correct because of the fundamental AWS principle that an explicit deny in an S3 bucket policy overrides any allow from IAM—meaning the public read grant in the bucket policy was the root cause of the exposure. By removing that policy and instead using IAM policies on the specific service roles, you ensure that only authorized principals can access the bucket, while the S3 bucket policy deny override behavior no longer threatens security. On the DEA-C01 exam, this scenario tests your understanding of the interaction between resource-based policies (bucket policies) and identity-based policies (IAM), a common trap where candidates confuse Macie’s detection role with enforcement. Remember: bucket policies affect all principals unless explicitly restricted, while IAM policies scope access to specific users or roles. Memory tip: “Deny always wins—so remove the public allow, then grant with IAM.”

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

Remove the bucket policy granting public access and attach an IAM policy to the Glue and Athena roles to allow access to the bucket.

The most effective because it removes the public access grant while using IAM policies to authorize only the necessary roles (Glue and Athena). Option A is incorrect because Amazon Macie only identifies PII and cannot remediate access controls. Option C is insufficient because setting the bucket ACL to private does not change existing object ACLs that may grant public access, and using a bucket policy alone does not address object ACL overrides. Option D is incorrect because S3 Block Public Access prevents all public access but using service principals (like the Glue or Athena service principal) is not appropriate for intra-account access; IAM roles must be used to allow authorized users and services.

Answer analysis

Option-by-option breakdown

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

  • Use Amazon Macie to automatically remediate the public access by updating the object ACLs.

    Why it's wrong here

    Macie is for detection, not remediation.

  • Remove the bucket policy granting public access and attach an IAM policy to the Glue and Athena roles to allow access to the bucket.

    Why this is correct

    This removes public access while allowing authorized access.

  • Set the bucket ACL to private and add a bucket policy that allows access to the Glue crawler and Athena.

    Why it's wrong here

    ACLs are not recommended; also, the bucket policy may still allow public access if not carefully written.

  • Enable S3 Block Public Access on the bucket and use a bucket policy to allow access from the Glue and Athena service principals.

    Why it's wrong here

    Block Public Access prevents all public access, but service principals cannot be used in bucket policies for Glue and Athena; you need IAM roles.

Visual reference

Source Router + ACL permit 10.0.0.0/8 deny any Server 10.0.0.5 ✓ 192.168.1.1 ✗ dropped ACLs evaluate top-down; first match wins — implicit deny all at end

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,711 original DEA-C01 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

Same concept, more angles

3 more ways this is tested on DEA-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 data engineer needs to allow a Lambda function to read data from an S3 bucket in the same account. The Lambda function's execution role has the required permissions, but access is denied. The S3 bucket has a bucket policy that explicitly denies access to any principal that is not from the organization. What is the most likely issue?

medium
  • A.The Lambda execution role is not part of the AWS organization.
  • B.The Lambda function is in a VPC without an S3 VPC endpoint.
  • C.The S3 bucket is in a different AWS account.
  • D.The Lambda function does not have kms:Decrypt permission.

Why A: The bucket policy explicitly denies access to any principal that is not from the AWS organization. Since the Lambda execution role is not part of the organization, the explicit deny overrides any allow permissions granted to the role. Option B is incorrect because the VPC endpoint policy is not mentioned in the scenario. Option C is incorrect because the bucket is in the same account. Option D is incorrect because KMS permissions are not relevant to this access denial.

Variation 2. Refer to the exhibit. An S3 bucket policy allows the DataEngineerRole to get objects only if the request uses HTTPS. However, requests from this role are being denied even when using HTTPS. What is the MOST likely reason?

hard
  • A.The IAM role does not have permission to use SSE-S3.
  • B.The condition key aws:SecureTransport is misspelled.
  • C.The bucket policy does not include a Deny statement for HTTP requests.
  • D.The IAM role's attached policy does not allow s3:GetObject on the bucket.

Why D: Even though the bucket policy condition requires HTTPS, the IAM role must also have an IAM policy that explicitly allows s3:GetObject on the bucket. Without this, the request is denied regardless of the bucket policy. Option A is incorrect because SSE-S3 does not require explicit IAM permissions; it is a server-side encryption option that works by default. Option B is incorrect because aws:SecureTransport is spelled correctly; misspelling would cause the condition to not apply, potentially allowing HTTP, but the issue is requests being denied. Option C is incorrect because the bucket policy uses a condition to require HTTPS, which effectively denies HTTP requests even without a separate Deny statement.

Variation 3. A company is using Amazon EMR to process data stored in Amazon S3. The S3 bucket is configured with a bucket policy that denies access unless the request includes a specific tag. The EMR cluster's IAM role has s3:GetObject permission. However, the EMR job fails to read data from S3. What is the most likely cause?

hard
  • A.The bucket policy is not attached to the EMR role.
  • B.The EMR cluster is not in the same account as the S3 bucket.
  • C.The IAM role does not have a condition that matches the required tag.
  • D.The EMR role does not have s3:GetObject permission.

Why C: The bucket policy denies access unless the request includes a specific tag. Even though the EMR cluster's IAM role has s3:GetObject permission, the IAM role does not have a condition key (e.g., aws:RequestTag) that matches the required tag. Therefore, the request is denied by the bucket policy, causing the EMR job to fail.

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This DEA-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 DEA-C01 exam.