One CDK bucket, two properties — index and error documents, no console click-through required.
A hosting-enabled bucket gets a dedicated URL:
http://<bucketname>.s3-website.eu-central-1.amazonaws.com. A request to
that URL makes S3 retrieve the bucket's designated root object —
usually index.html — and serve it. No traditional web server to patch,
scale, or keep running.
Heads up: that URL is
http://, nothttps://— the S3 website endpoint doesn't support TLS at all. (It's also region-specific in its own way: this dot-separateds3-website.<region>.amazonaws.comformat is what regions added from 2014 onward use, including this platform's owneu-central-1— the handful of original 2006-2013 regions use a dash instead,s3-website-<region>.amazonaws.com.)
In CDK, "create the bucket" and "configure it for website hosting" are the
same statement — a single constructor call, not a separate step. Bucket
(imported from aws-cdk-lib/aws-s3 — already
imported in the starter) takes websiteIndexDocument and
websiteErrorDocument right in its constructor —
there's no separate "enable hosting" step to remember.
On the right, the starter construct creates a bucket but never enables
hosting. Set websiteIndexDocument to "index.html" and
websiteErrorDocument to "error.html", then run the synthesizer.
Tip:
error.htmlis what S3 serves when a request 404s — the same role a custom 404 page plays on any web server.
Edit the construct, then run synth & validate to check your work.