exam questions

Exam AWS Certified Developer - Associate DVA-C02 All Questions

View all questions & answers for the AWS Certified Developer - Associate DVA-C02 exam

Exam AWS Certified Developer - Associate DVA-C02 topic 1 question 281 discussion

A developer creates a static website for their department. The developer deploys the static assets for the website to an Amazon S3 bucket and serves the assets with Amazon CloudFront. The developer uses origin access control (OAC) on the CloudFront distribution to access the S3 bucket.

The developer notices users can access the root URL and specific pages but cannot access directories without specifying a file name. For example, /products/index.html works, but /products/ returns an error. The developer needs to enable accessing directories without specifying a file name without exposing the S3 bucket publicly.

Which solution will meet these requirements?

  • A. Update the CloudFront distribution's settings to index.html as the default root object is set.
  • B. Update the Amazon S3 bucket settings and enable static website hosting. Specify index.html as the Index document. Update the S3 bucket policy to enable access. Update the CloudFront distribution's origin to use the S3 website endpoint.
  • C. Create a CloudFront function that examines the request URL and appends index.html when directories are being accessed. Add the function as a viewer request CloudFront function to the CloudFront distribution's behavior.
  • D. Create a custom error response on the CloudFront distribution with the HTTP error code set to the HTTP 404 Not Found response code and the response page path to /index.html. Set the HTTP response code to the HTTP 200 OK response code.
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
examuserss
4 months, 1 week ago
Selected Answer: A
The best solution is Option A: Update the CloudFront distribution's settings to index.html as the default root object. This is the simplest and most operationally efficient way to ensure that CloudFront automatically serves the index.html file when a user requests a directory, without needing to expose the S3 bucket publicly or implement complex logic.
upvoted 1 times
...
Saurabh04
8 months, 3 weeks ago
Selected Answer: B
Enable static website hosting on the S3 bucket. Specify index.html as the Index document. Update the S3 bucket policy to allow access. Configure the CloudFront distribution’s origin to use the S3 website endpoint. Pros: Handles both root and subdirectories. Keeps the S3 bucket private. Cons: Requires S3 bucket policy adjustments.
upvoted 1 times
...
65703c1
11 months, 2 weeks ago
Selected Answer: C
C is the correct answer.
upvoted 2 times
...
KarBiswa
1 year, 1 month ago
Selected Answer: C
https://aws.amazon.com/blogs/networking-and-content-delivery/implementing-default-directory-indexes-in-amazon-s3-backed-amazon-cloudfront-origins-using-cloudfront-functions/
upvoted 4 times
...
Abdullah22
1 year, 1 month ago
going with B.
upvoted 2 times
...
SerialiDr
1 year, 1 month ago
Selected Answer: C
This solution allows for the dynamic handling of requests to directories by automatically appending index.html to the path when a directory is requested. This approach does not require exposing the S3 bucket publicly or modifying S3 bucket settings for static website hosting. It leverages CloudFront's capabilities to manipulate the request at the edge location before it reaches the origin, ensuring that users can access directories without specifying a file name in the most secure and efficient manner.
upvoted 3 times
...
HD98
1 year, 2 months ago
C is the right option
upvoted 1 times
...
ANDRES715
1 year, 2 months ago
Selected Answer: B
Al habilitar el alojamiento de sitios web estáticos en el depósito de Amazon S3 y especificar index.html como documento de índice, se permite el acceso a los directorios sin especificar un nombre de archivo. Al mismo tiempo, al actualizar la política del depósito S3 para habilitar el acceso y el origen de la distribución de CloudFront para utilizar el punto final del sitio web de S3, se garantiza que el acceso se gestione de manera segura sin exponer públicamente el depósito de S3.
upvoted 2 times
...
CrescentShared
1 year, 2 months ago
Selected Answer: C
When you enable static website hosting on an S3 bucket, you can specify an index document, which S3 automatically returns when a user requests a directory. However, changing the CloudFront origin to the S3 website endpoint would expose the S3 bucket publicly, which contradicts the requirement to keep the S3 bucket private.
upvoted 2 times
HD98
1 year, 2 months ago
C correct
upvoted 1 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago