0
0
AWScloud~20 mins

Static website hosting on S3 in AWS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
S3 Static Website Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
service_behavior
intermediate
2:00remaining
How does S3 handle website index documents?

You configure an S3 bucket for static website hosting and set index.html as the index document. What happens when a user visits the root URL of the website?

AS3 returns a 404 error because no specific file is requested.
BS3 returns the <code>index.html</code> file from the root of the bucket as the homepage.
CS3 returns a list of all files in the bucket as a directory listing.
DS3 redirects the user to the AWS Management Console.
Attempts:
2 left
💡 Hint

Think about what an index document means for a website.

security
intermediate
2:00remaining
What is required to make an S3 bucket publicly accessible for static website hosting?

You want to host a public static website on S3. Which configuration is necessary to allow anyone on the internet to access the website files?

ASet the bucket policy to allow public read access and disable Block Public Access settings.
BEnable versioning on the bucket and use IAM roles for access.
CCreate a VPC endpoint for the bucket and restrict access to the VPC.
DUse AWS KMS encryption and require MFA for access.
Attempts:
2 left
💡 Hint

Public website means anyone can read the files without signing in.

Configuration
advanced
2:30remaining
Which S3 bucket policy correctly allows public read access for static website hosting?

Choose the bucket policy JSON that correctly grants public read access to all objects in the bucket named example-bucket.

A
{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Principal": "*",
    "Action": "s3:ListBucket",
    "Resource": "arn:aws:s3:::example-bucket"
  }]
}
B
{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Deny",
    "Principal": "*",
    "Action": "s3:PutObject",
    "Resource": "arn:aws:s3:::example-bucket/*"
  }]
}
C
{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Principal": {"AWS": "arn:aws:iam::123456789012:user/admin"},
    "Action": "s3:GetObject",
    "Resource": "arn:aws:s3:::example-bucket/*"
  }]
}
D
{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Principal": "*",
    "Action": "s3:GetObject",
    "Resource": "arn:aws:s3:::example-bucket/*"
  }]
}
Attempts:
2 left
💡 Hint

Public read means allowing everyone to get objects, not just listing the bucket.

Architecture
advanced
2:30remaining
How to configure custom domain with HTTPS for S3 static website hosting?

You want to serve your S3 static website using your own domain with HTTPS. Which AWS service combination is the best practice to achieve this?

ADirectly point your domain's DNS to the S3 website endpoint and enable HTTPS on S3.
BUse Route 53 alias record pointing to the S3 bucket and enable HTTPS in the bucket properties.
CUse Amazon CloudFront with an SSL certificate from AWS Certificate Manager and point your domain to CloudFront distribution.
DCreate an EC2 instance with a web server to proxy requests to the S3 bucket and install SSL there.
Attempts:
2 left
💡 Hint

S3 website endpoints do not support HTTPS directly.

Best Practice
expert
3:00remaining
What is the recommended way to handle 404 errors on an S3 static website?

You want to show a custom error page when users visit a non-existent page on your S3 static website. How should you configure this?

ASet the <code>error document</code> property in the S3 static website hosting configuration to the custom error page file name.
BCreate a Lambda function to intercept 404 errors and redirect to the custom error page.
CEnable versioning on the bucket and upload the error page as the latest version.
DConfigure the bucket policy to redirect 404 errors to the custom error page.
Attempts:
2 left
💡 Hint

S3 static website hosting has a built-in setting for error documents.