INFRASTRUCTURE LEARNINGINFRASTRUCTURE LEARNING
インフラ大全インフラ大全IT INFRASTRUCTURE / LEARNING
Infrastructure learning guide
Find a lesson or lab/

Esc to close · Search terms stay on your device

LEARNING日本語

Topic lessonTopic: S3 operations, storage choices and web delivery

S3 static websites and CloudFront: HTTPS, OAC and access boundaries

An S3 website endpoint serves publicly readable content over HTTP. To serve HTTPS while restricting direct S3 access, distinguish CloudFront, an S3 REST origin and OAC. Use a fictional public documentation site to separate endpoints, viewers, index documents and errors.

What you will learn

Distinguish website endpoints from REST origins, identify HTTPS boundaries, separate OAC from viewer authorization and verify path/error behavior.

Prerequisite

A static site serves HTML, CSS, images and similar files. An origin supplies the content CloudFront fetches; HTTPS encrypts a connection. Only synthetic content intended for public reading is used; no distribution or DNS changes are made.

Website and REST endpoints have different behavior

A website endpoint provides web behavior such as configured index documents and redirects. A REST endpoint exposes object API access with HTTPS and authenticated requests. Adding https to a website endpoint does not make it support HTTPS.

Distinguish the two S3 endpoints
QuestionWebsite endpointREST endpoint
HTTPSNot supported by S3 website itselfSupported
Content accessPublicly readable contentCan support private/authenticated access
Index behaviorWebsite index-document configurationWebsite index settings do not apply
CloudFront integrationCustom origin; no OAC/OAIS3 origin can use OAC

W1: keep the origin private for a public site

W1 is a fictional site serving synthetic documentation intended for public reading. Viewers use HTTPS to CloudFront, which uses Origin Access Control (OAC) to request a non-public S3 REST origin. The design keeps all four BPA settings and restricts the allowed CloudFront distribution through a bucket-policy condition.

W1: separate the viewer connection from origin access
W1: separate the viewer connection from origin access1: Viewer — Fetch over HTTPS — CloudFront. 2: CloudFront — Origin request — Sign origin requests. 3: Sign origin requests — Signed HTTPS request — Private S3 REST origin123ViewerCloudFrontSign originrequestsPrivate S3 RESToriginW1: separate the viewer connection from origin access1: Viewer — Fetch over HTTPS — CloudFront. 2: CloudFront — Origin request — Sign origin requests. 3: Sign origin requests — Signed HTTPS request — Private S3 REST origin123ViewerCloudFrontSign originrequestsPrivate S3 RESTorigin
  1. Viewer → CloudFrontFetch over HTTPS
  2. CloudFront → Sign origin requestsOrigin request
  3. Sign origin requests → Private S3 REST originSigned HTTPS request
Viewer
Reads public documentation
CloudFront
Viewer HTTPS policy
Sign origin requests
Always-sign setting
Private S3 REST origin
Distribution-scoped policy

OAC configures origin-request authentication; it is not a separate server in the diagram. With always-sign selected, CloudFront-to-S3 requests use HTTPS. Check viewer-to-CloudFront HTTPS separately; do not extend this guarantee to unsigned configurations.

Creating OAC alone does not finish permission setup. Match the bucket/object scope, CloudFront service principal and distribution SourceArn condition. AWS KMS manages encryption keys; SSE-KMS adds permission requirements for the selected key. This lesson explains the relationship without collecting production policies.

A private S3 origin does not authenticate viewers

OAC does not automatically decide which viewers may read the content. W1 intentionally permits anonymous reading through CloudFront. Internal-only reports require a separate viewer authentication/authorization design, potentially including signed URLs or cookies. Blocking direct S3 URLs alone does not establish internal-only access.

Checks against W1’s stated intent
RequestW1 intentWhat it does not prove
Read documentation through CloudFrontRetrieve expected content over HTTPSDoes not establish internal-only access.
Anonymous request directly to S3Refused by non-public origin policyDoes not prove every CloudFront setting is correct.
Another distribution requests S3Outside the allowed distribution conditionVerify actual policies rather than assuming they match.

Check root, nested paths and errors separately

CloudFront’s default root object index.html does not automatically append index.html to every nested path. This differs from S3 website index-document behavior. With a REST origin, decide how /docs/ maps to object keys and any required rewrite policy.

W2: define expectations per path
Viewer requestExpected resultCheck
/Top-level index.htmlDefault root setting and actual key.
/docs/index.htmlThe deployed documentCase-sensitive key and content.
/docs/The explicitly designed URL behaviorDo not assume root-object configuration rewrites it.
/missing-page.htmlAn error for a nonexistent pageInspect HTTP status as well as page content.

An SPA changes views in the browser. Distinguish an intentional application-route fallback from mapping missing assets/documents and permission failures indiscriminately to 200. CloudFront can change response codes, so inspect origin results and viewer-visible results separately.

Error content returned with 200 can be treated as a soft 404, while 200 alone does not guarantee indexing. W2 separately tests real documents, intentional application routes and truly nonexistent URLs. A response-code rewrite does not substitute for release acceptance.

Verify origin, viewers and delivered content before release

  1. Define allowed viewers and URLs using synthetic public-safe content.
  2. Identify website versus REST origin and the required behavior/OAC support.
  3. Verify viewer HTTPS, origin signing and bucket/distribution/KMS permissions separately.
  4. Define content and HTTP expectations for root, nested, existing, missing and denied requests.
  5. Verify delivered content including cache effects and unintended direct access.
  6. Plan cleanup for distribution/DNS references and retained S3 data/cost resources.

Check endpoint and access-boundary decisions

Choose an option to see the result and explanation.

CloudFront uses an S3 website endpoint as its origin. Can OAC make that origin private?
Read the answer and reason

Answer: No; distinguish an S3 REST origin that supports OAC. · Website endpoints do not support OAC/OAI.

W1 has OAC and a non-public S3 origin. Does that prove only employees can read through CloudFront?
Read the answer and reason

Answer: No; viewer authentication/authorization is separate. · W1 intentionally serves public documentation.

The default root object is index.html. Must /docs/ resolve to docs/index.html?
Read the answer and reason

Answer: No; verify nested-path rules and actual keys. · CloudFront root settings differ from S3 website index behavior.

A nonexistent document returns an error body with HTTP 200. Is release acceptance established?
Read the answer and reason

Answer: No; compare expected status and content. · Separate real and missing resources rather than masking errors.

Check, then explain in your own words

  1. Explain website versus REST endpoints.
  2. Separate W1 HTTPS and OAC boundaries.
  3. Decide viewer authorization separately.
  4. Verify W2 real/missing paths and HTTP behavior.
Check your understanding: Direct S3 access is denied and CloudFront serves the public document. What remains to verify for W1?

Verify the intended distribution, signing/permission conditions, HTTPS on each connection and content/cache/error behavior for the target URLs. Internal-only access would require a separate viewer-authorization requirement.

One successful URL does not establish correct access boundaries or the entire release.

Sources and conditions checked

The official references used in this lesson are collected here with their scope, conditions and corresponding sections. Independent expert review and live AWS comparison have not been performed.