S3 Front-End Bucket

An S3 Bucket for the Static Front End

BookNest's front end is one HTML page, which S3 24 static website hosting serves with no server: plain HTTP at a website endpoint, / mapped to an index document, an error document for missing keys.

infra/booknest-web.yaml: the front-end bucket with website hostingYAML
  FrontEndBucket:
    Type: AWS::S3::Bucket
    Properties:
      BucketName: !Sub booknest-web-${AWS::AccountId}
      WebsiteConfiguration: {IndexDocument: index.html, ErrorDocument: error.html}
      OwnershipControls: {Rules: [{ObjectOwnership: BucketOwnerEnforced}]}

Bucket names are global, so the account ID (000000000000 here) avoids collisions. BucketOwnerEnforced, the default for new buckets, disables object ACLs, leaving policies as the only grant.

The page, web/index.html, is the baseline's public/index.html with one change: instead of /api/books, it fetches the address in a config.json beside it and prints that address under the table, so one file serves a static snapshot now and the API in Full Stack Deploy. The endpoint speaks only HTTP; production sites add CloudFront 24 in front for HTTPS (not in the Community image).