Advanced Concepts in Static Website Hosting: S3 and CloudFront Quiz

Challenge your knowledge of static website hosting with object storage and content delivery networks, covering website deployment, security, caching strategies, and error handling. This quiz helps reinforce best practices and key concepts for efficiently serving static websites on scalable platforms.

  1. Static Website Hosting Configuration

    When enabling static website hosting for an object storage bucket, which setting must be configured to define the main page of your site?

    1. Cache policy
    2. Origin access identity
    3. Index document
    4. Access control list

    Explanation: Index document is the setting that specifies the main file to load, typically index.html, when users access your website. Access control lists are for managing permissions but do not define landing pages. Origin access identities relate to content delivery network access control, not the website's entry point. Cache policies manage how assets are cached and are unrelated to the website's main page.

  2. Public Access Considerations

    Which configuration ensures that your static website is accessible to all users over the internet?

    1. Enabling MFA delete
    2. Using a signed URL
    3. Enabling versioning
    4. Bucket policy allowing public read

    Explanation: A bucket policy allowing public read gives all users access to the website's files, making your site public. Versioning controls object versions, not public accessibility. Enabling MFA delete is for security and does not influence website availability. Signed URLs restrict access to specific users and are typically used for private content, not public sites.

  3. Distribution Integration

    What is the primary benefit of connecting your static site bucket to a content delivery network (CDN)?

    1. Enhanced server-side scripting
    2. Reduced need for object versioning
    3. Automatic database backups
    4. Faster content delivery worldwide

    Explanation: A CDN caches your static content at multiple locations, leading to fast global delivery by serving users from the nearest edge location. Automatic backups are a storage function, not a CDN feature. Server-side scripting is not supported in static hosting. Object versioning is a separate storage feature and is not replaced by using a CDN.

  4. CORS Settings

    If your static site needs to load resources like fonts or images from your bucket via client-side scripts, which configuration is essential to allow this?

    1. CORS configuration
    2. Edge location replica
    3. Origin failover option
    4. Enabling object lock

    Explanation: Cross-Origin Resource Sharing (CORS) must be enabled and configured for browsers to allow cross-origin resource access, such as fetching fonts or images. Edge location replicas are part of content delivery network operations. Origin failover handles availability and does not regulate browser security. Object lock is used for legal holds and retention, unrelated to resource sharing.

  5. Custom Error Responses

    To show a user-friendly 404 page instead of a generic error when a file is not found on your static site, which feature should you configure?

    1. Lifecycle policies
    2. Access logs
    3. Custom error responses
    4. Monitoring metrics

    Explanation: Custom error responses allow you to define error pages, such as a custom 404.html, enhancing user experience when resources are missing. Monitoring metrics provide performance or usage statistics, not error customization. Access logs contain records about requests, not user-facing error displays. Lifecycle policies manage object retention, not error handling.

  6. Restricting Direct Bucket Access

    What setting is typically used to prevent users from accessing static website files directly from the bucket URL, requiring all access to pass through the CDN?

    1. Blocking public access and using an origin access identity
    2. Setting default encryption
    3. Enabling website hosting
    4. Enabling multipart uploads

    Explanation: Blocking public access combined with an origin access identity restricts users from bypassing the CDN and ensures all file requests go through controlled distribution. Enabling website hosting serves the files but does not block direct access. Multipart uploads handle large file uploads but are unrelated to access controls. Default encryption secures data but does not restrict public access.

  7. Caching Behavior

    If you update an image on your static site but users still see the old version, which CDN configuration is likely causing this?

    1. Enabled transfer acceleration
    2. Disabled static hosting
    3. MFA delete requirements
    4. High TTL cache setting

    Explanation: A high TTL (time to live) cache setting tells the CDN to keep old copies of content longer, causing users to see outdated resources after updates. Disabled static hosting would prevent the site from serving at all, not just old files. Transfer acceleration relates to upload speed. MFA delete is a security feature, not a caching parameter.

  8. Redirect Rules

    How can you automatically redirect users from /old-page.html to /new-page.html on your static website?

    1. Apply server-side rewrite scripts
    2. Enable versioning with replication
    3. Schedule a storage transfer job
    4. Configure a redirect rule in the static website hosting settings

    Explanation: Redirect rules within static website hosting let you automatically forward users from one path to another. Server-side scripts cannot be run in static hosting environments. Storage transfer jobs are used for object migration, not user navigation. Versioning and replication handle copies and versions, not redirects.

  9. Security Headers

    To enhance security for your static website, which HTTP response header should be added to prevent your site from being embedded in frames on other domains?

    1. Accept-Language
    2. X-Frame-Options
    3. Cache-Control
    4. Content-Encoding

    Explanation: X-Frame-Options is used to control whether your website can be embedded in frames, helping prevent clickjacking attacks. Content-Encoding specifies compression methods and does not offer frame protection. Accept-Language is for language preference and unrelated to security. Cache-Control directs caching behaviors, not frame usage.

  10. Invalidation Requests

    After updating several files on your static website, which action ensures that users receive the latest versions from the CDN immediately?

    1. Submit an invalidation request
    2. Enable multipart upload
    3. Turn off static website hosting
    4. Increase object retention policy

    Explanation: An invalidation request tells the CDN to remove cached files, so users get updated versions immediately. Enabling multipart upload helps with uploading, not cache refresh. Turning off static hosting disables your website entirely. Increasing object retention relates to data deletion, not content updating.