AWS Certified Developer - Associate Exam | Common Issues with Hosting Static Websites on S3

Common Issues with Hosting Static Websites on S3

Prev Question Next Question

Question

Your team has decided to host a static website using the Simple Storage Service.

A bucket has been defined with the domain name, the objects uploaded, and the static web site hosting enabled for the bucket.

But you are still not able to access the web site.

Which of the following could be the underlying issue?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Answer - B.

The AWS Documentation mentions the following.

To host a static website, you configure an Amazon S3 bucket for website hosting and then upload your website content to the bucket.

This bucket must have public read access.

It is intentional that everyone in the world will have read access to this bucket.

Option A is incorrect since this feature is used to avoid accidental deletion of objects.

Option C is incorrect since the storage class should ideally be standard storage.

Option D is incorrect since this is used for the encryption of objects at rest.

For more information on static web site hosting, please refer to the below URL-

https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html

The most probable issue in this scenario is that the bucket does not have public read access. By default, the objects stored in Amazon S3 buckets are private, which means that only the bucket owner has access to the data. To enable access to the static website hosted in the S3 bucket, the objects must be made publicly accessible.

To make the objects publicly accessible, you need to grant public read access to the bucket or the objects themselves. To grant public read access to the bucket, you can configure a bucket policy that allows access to all objects in the bucket. Here is an example bucket policy that grants public read access to all objects in the bucket:

json
{ "Version": "2012-10-17", "Statement": [ { "Sid": "PublicRead", "Effect": "Allow", "Principal": "*", "Action": [ "s3:GetObject" ], "Resource": [ "arn:aws:s3:::example-bucket/*" ] } ] }

This policy grants the "s3:GetObject" permission to all users ("Principal": "") to access all objects in the bucket with the key prefix "/" ("Resource": "arn:aws:s3:::example-bucket/*").

Regarding the other options:

A. Enabling versioning for the bucket is not required to host a static website using Amazon S3.

C. The storage class (standard, infrequent access, etc.) does not affect the ability to access a static website hosted in an S3 bucket.

D. Using AWS managed keys (SSE-S3) is not required to host a static website using Amazon S3.