Draw the boundary around the dynamic work
A marketing website can render most routes at build time even when it needs a contact workflow. Build files go in a private object store behind a CDN. The form calls a narrowly scoped HTTPS endpoint that validates the request and handles delivery. Content reads and submissions now have independent cost and failure profiles.
The model changes when pages need personalized server rendering, per-request authorization or synchronized updates that cannot wait for a build. Identify those requirements up front. A hybrid with a separate application can be simpler than forcing an authenticated product through static hosting.
- Browser
- CloudFront
- private S3
- Browser
- API Gateway
- Lambda
- SES
Design caching around file identity
Give content-hashed JavaScript and CSS long cache lifetimes because their names change with their contents. Let browser-facing HTML and route payloads revalidate so visitors receive a coherent release. Account for pretty URLs and trailing slashes in the CDN rewrite, and test actual link clicks as well as direct requests.
Upload hashed assets before updating HTML. Retain the previous release’s assets during rollout so open browser tabs can still load them. Invalidate the stable URLs that change and keep a reproducible build artifact for rollback. Deleting every prior asset as part of an upload is a release decision with real user impact.
Keep origin permissions and abuse limits explicit
Scope S3 reads to the distribution and leave public access blocked. Keep credentials out of browser code. A contact handler should validate field lengths, constrain the sender and destination, and limit burst traffic before delivery. Browser CORS rules help control which origins may read responses, while server-side validation and throttling apply to every caller.
Set budgets around request volume and delivery, and check service failures separately from static-site uptime. A healthy CDN can continue serving the contact page even when mail delivery fails, so put an alert on the API or delivery path itself.
Measure where costs and latency come from
Use separate budgets for CDN transfers, request processing and operational logs. Capture cache-hit rates and compare mobile cold-load behavior before adding new services. A small number of oversized images can dominate transfer over an otherwise inexpensive architecture.
Static delivery trades runtime flexibility for predictable operations. Reassess when the publishing cadence, authentication needs or data freshness exceed what a build and cache policy can support.
Key takeaways
- Separate static delivery and write operations.
- Make HTML freshness and hashed assets part of a release plan.
- Monitor the contact pipeline independently from page availability.