0

I need to serve static HTML Pages w/ multiple assets (html, css, js & other asset files) but with different conditions:

  • Serverless (must be on S3)
  • Can handle multiple static Pages w/ multiple pages and other static assets like css, js, image or font files. (see example below)
  • Has an expiration - The goal is the user cannot share the limited-time URL of the static HTML page

Below are all my ideas (correct me if I'm wrong):

  • Render directly on Web level - Web support rendering of a specific asset but cannot create a new page for loading all assets
  • Serve on S3 level - The question is how can you authorize users w/ limited-time access to multiple files?
    • Presigned URL? - A pre-signed URL is valid for only one object.
  • Store on S3 bucket and Serve on CloudFront - Same question on S3 level. How can you authorize users w/ limited-time access to multiple files?
  • Serve on S3 level publicly - Every time user requests access, copy all files to a new public folder w/ expiration, serve publicly and give the new URL to the user.
    • maybe slow? maybe costly?

  #example file structure
  .
  +-- index.html
  +-- media
  |   +-- banner.jpg
  |   +-- video.mp4
  +-- styles
  |   +-- main.css
  +-- js
  |   +-- main.js
  +-- about.html
  +-- contact.html

Any advice and suggestions will be greatly appreciated.

John Paulo Rodriguez
  • 1,280
  • 18
  • 21

1 Answers1

0

What I did is serve the S3 Bucket via API Gateway. The expiration and authorization will be handled on the API Gateway side. Please see the documentation here: https://docs.aws.amazon.com/apigateway/latest/developerguide/integrating-api-with-aws-services-s3.html

To handle subdirectories, you can follow the instruction here: https://stackoverflow.com/a/60336354/6455686

John Paulo Rodriguez
  • 1,280
  • 18
  • 21