Courseiva
DeploymenteasyMultiple ChoiceObjective-mapped

DVA-C02 Deployment Practice Question

A developer is deploying a static website to Amazon S3 and wants to use Amazon CloudFront for content delivery. The developer wants to ensure that only CloudFront can access the S3 bucket. Which S3 bucket policy should the developer use?

⚠ Common exam trap

It's easy for candidates to choose IP-based restrictions (Option C) or Referer header checks (Option A) because they seem simpler, but AWS explicitly recommends OAI for secure S3 origin access in CloudFront, and the exam tests this best practice.

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

Grant CloudFront access via an origin access identity (OAI) and restrict the bucket policy to the OAI.

An Origin Access Identity (OAI) is a special CloudFront user that you can associate with your distribution. By configuring the S3 bucket policy to grant access only to that OAI, you ensure that direct S3 requests are denied, and only requests routed through CloudFront can retrieve objects. This provides a secure, private origin without exposing the bucket publicly.

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 a bucket policy that allows access only if the Referer header matches the CloudFront distribution domain.

    Why it's wrong here

    Relying on the Referer HTTP header for access control is fundamentally insecure because this header can be easily spoofed by malicious actors. While it might appear to restrict direct access, any client can manipulate the Referer value to impersonate a legitimate CloudFront request, thereby bypassing the intended security measure and directly accessing the S3 bucket content. This method provides a false sense of security and does not adequately protect the origin.

  • Make the bucket public and use CloudFront's default caching.

    Why it's wrong here

    Making the S3 bucket publicly accessible allows anyone on the internet to directly access its contents, bypassing CloudFront entirely. While CloudFront would still cache content, the origin bucket itself would be exposed to direct requests, potential enumeration, and unauthorized access, negating the security benefits of using CloudFront as a protective layer. This configuration fails to secure the origin, which is a primary goal when using CloudFront with S3.

  • Grant CloudFront access by allowing the CloudFront IP address range.

    Why it's wrong here

    Granting access based on CloudFront's IP address ranges is an impractical and unreliable security measure. CloudFront's IP address ranges are dynamic, frequently change, and are extensive, making it difficult to maintain an accurate and up-to-date bucket policy. Furthermore, these IP ranges are shared across all CloudFront users, meaning this approach does not uniquely identify your CloudFront distribution, potentially allowing other CloudFront users to access your bucket if they know the URL.

  • Grant CloudFront access via an origin access identity (OAI) and restrict the bucket policy to the OAI.

    Why this is correct

    Granting CloudFront access through an Origin Access Identity (OAI) is the recommended and most secure method. An OAI is a special CloudFront user that you associate with your distribution, and then you modify the S3 bucket policy to explicitly grant read permissions only to this specific OAI. This ensures that content can only be accessed through your CloudFront distribution, preventing direct public access to the S3 bucket and securing your origin.

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 724 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.