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.
Distinguish website endpoints from REST origins, identify HTTPS boundaries, separate OAC from viewer authorization and verify path/error behavior.
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.
| Question | Website endpoint | REST endpoint |
|---|---|---|
| HTTPS | Not supported by S3 website itself | Supported |
| Content access | Publicly readable content | Can support private/authenticated access |
| Index behavior | Website index-document configuration | Website index settings do not apply |
| CloudFront integration | Custom origin; no OAC/OAI | S3 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.
- Viewer → CloudFrontFetch over HTTPS
- CloudFront → Sign origin requestsOrigin request
- 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.
| Request | W1 intent | What it does not prove |
|---|---|---|
| Read documentation through CloudFront | Retrieve expected content over HTTPS | Does not establish internal-only access. |
| Anonymous request directly to S3 | Refused by non-public origin policy | Does not prove every CloudFront setting is correct. |
| Another distribution requests S3 | Outside the allowed distribution condition | Verify 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.
| Viewer request | Expected result | Check |
|---|---|---|
| / | Top-level index.html | Default root setting and actual key. |
| /docs/index.html | The deployed document | Case-sensitive key and content. |
| /docs/ | The explicitly designed URL behavior | Do not assume root-object configuration rewrites it. |
| /missing-page.html | An error for a nonexistent page | Inspect 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
- Define allowed viewers and URLs using synthetic public-safe content.
- Identify website versus REST origin and the required behavior/OAC support.
- Verify viewer HTTPS, origin signing and bucket/distribution/KMS permissions separately.
- Define content and HTTP expectations for root, nested, existing, missing and denied requests.
- Verify delivered content including cache effects and unintended direct access.
- 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.
Check, then explain in your own words
- Explain website versus REST endpoints.
- Separate W1 HTTPS and OAC boundaries.
- Decide viewer authorization separately.
- 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.
- S3 website endpointsChecked:
Scope and conditionsWebsite versus REST HTTPS, authentication and index behavior. Documentation review, not live AWS verification.
Used in this lessonWebsite and REST endpoints have different behavior
Scope and conditionsREST origin/OAC, always-sign behavior and distribution condition; no OAC on website custom origins. Documentation review, not live AWS verification.
Used in this lessonWebsite and REST endpoints have different behavior W1: keep the origin private for a public site
- S3 static website configurationChecked:
Scope and conditionsPublic-read HTTP website versus private origin with CloudFront OAC. Documentation review, not live AWS verification.
Used in this lessonW1: keep the origin private for a public site
Scope and conditionsOrigin restrictions and viewer authorization are distinct. Documentation review, not live AWS verification.
Used in this lessonA private S3 origin does not authenticate viewers
- CloudFront: Default root objectChecked:
Scope and conditionsRoot index differs from subdirectory rewriting and S3 website behavior. Documentation review, not live AWS verification.
Used in this lessonCheck root, nested paths and errors separately
Scope and conditionsConfigured viewer status can differ from origin status. Documentation review, not live AWS verification.
Used in this lessonCheck root, nested paths and errors separately
Scope and conditionsHTTP success does not guarantee indexing; error content returned with 200 can be a soft 404. Documentation review, not live AWS verification.
Used in this lessonCheck root, nested paths and errors separately