Private bucket origins via OAC, default root objects, and custom error responses for Lightsail CDN distributions.
Serve content from a private S3 bucket through CloudFront using Origin Access Control. The bucket is only accessible via the CDN — direct S3 access is denied.
enablePrivateOriginAccess: true
Specify which file CloudFront returns when a viewer requests the root URL (/). Essential for static sites using S3 bucket origins that have no built-in index handling.
defaultRootObject: "index.html"
Map HTTP error codes to custom response pages with configurable caching TTL. Enables SPA routing (404 → 200 + /index.html) and branded error pages.
errorCode: 404 → responseCode: "200"
All new fields are gated behind the static_sites_phase_1 FAC flag. When the flag is off, fields are silently nulled.
• null = don't touch (PATCH semantics)
• "" for DRO = clear it
• [] for CER = clear all
• Origin required with private access
• DRO + CER only on single-name calls
• isPrivateOriginAccessEnabled: Bucket only (null for others)
• Fields absent when FAC off
Configure your distribution to serve your React/Vue/Angular app's index.html on 404, enabling client-side routing.
aws lightsail update-distribution \
--distribution-name my-spa \
--default-root-object index.html \
--custom-error-responses '[
{
"errorCode": 404,
"responseCode": "200",
"responsePagePath": "/index.html",
"errorCachingMinTTL": 10
},
{
"errorCode": 403,
"responseCode": "200",
"responsePagePath": "/index.html",
"errorCachingMinTTL": 10
}
]'
| Field | Constraint | Error |
|---|---|---|
| defaultRootObject | ≤ 512 chars, no leading /, no .., alphanumeric + ._/- | InvalidInput |
| customErrorResponses | Max 10 entries, unique errorCodes | InvalidInput |
| errorCode | One of: 400, 403, 404, 405, 414, 416, 500, 501, 502, 503, 504 | InvalidInput |
| responseCode | Numeric, 200–599 | InvalidInput |
| responsePagePath | Must start with / | InvalidInput |
| errorCachingMinTTL | 0 – 31,536,000 seconds | InvalidInput |
| responseCode + responsePagePath | Must both be present or both omitted | InvalidInput |
| enablePrivateOriginAccess | Requires origin (name + region) on Update; Bucket origins only for enable | InvalidInput |