Skip to main content
This guide explains Amazon S3’s static website hosting: how it serves static files (HTML/CSS/JS/assets) directly from an S3 bucket, what the endpoint looks like, pricing considerations, domain configuration, and recommended patterns for HTTPS and secure access. When a browser navigates to a URL it sends an HTTP GET request to a web server. The server responds with an HTML document, which the browser renders as the website. S3’s static website hosting lets S3 act as that server for static content.
A slide titled "Static Hosting" showing an avatar and an HTML file icon on the left, a server on the right, and bidirectional arrows labeled "HTTP GET" between them. A note below reads "A website is just an HTML file."

What you host in S3 for a static site

Static sites are composed of files that can all be stored as S3 objects: All these objects can be served via S3’s website endpoint once static website hosting is enabled.

Key constraints and access patterns

  • S3 static hosting supports only static content (client-side HTML/CSS/JS). For server-side rendering or backend logic, use compute services such as Amazon EC2, AWS ECS, or AWS Lambda.
  • To make a site publicly accessible directly via the S3 website endpoint, the objects must be publicly readable or you must place a CDN (for example, Amazon CloudFront) in front of the bucket and configure secure access.
To serve a website directly from S3 you must allow public reads (or put Amazon CloudFront in front of S3 and use an Origin Access Control (OAC) so the bucket objects can remain private). Be careful when changing public access settings—only expose the objects you intend to make public.

Pricing overview

S3 static website hosting uses standard S3 pricing components plus a small per-request fee for the website endpoint:
A slide titled "Pricing" showing user avatars with arrows to a storage-bucket icon (noting Price/GB for storage and egress) and a server icon labeled "Per request," illustrating cloud storage and request billing.
Pricing numbers evolve—at the time of recording GET requests on S3 Standard were approximately $0.0004 per 1,000 GET requests. Always consult the official AWS S3 pricing page for current rates: https://aws.amazon.com/s3/pricing/

Website endpoint format

When static website hosting is enabled for a bucket, S3 provides an HTTP website URL in this format:
Requesting that URL returns the configured index document (index.html) or an error document if a resource is not found.

Custom domains and HTTPS

To use a custom domain (for example, example.com or www.example.com):
  • Create an S3 bucket whose name exactly matches the domain you want to serve:
    • Apex (naked) domain: bucket named example.com
    • Subdomain: bucket named www.example.com
  • Configure DNS (for example with Amazon Route 53) to point your domain to the S3 website endpoint.
Important: S3 website endpoints only provide HTTP. For HTTPS on a custom domain you must front S3 with a CDN such as CloudFront and attach an TLS certificate (via AWS Certificate Manager (ACM)). For secure patterns and to avoid making S3 objects public, configure CloudFront to use the S3 REST API origin together with an Origin Access Control (OAC) so CloudFront fetches objects on behalf of clients and you can restrict direct access to the bucket.
To serve a custom domain over HTTPS, put Amazon CloudFront in front of the S3 bucket, attach an AWS Certificate Manager (ACM) certificate for TLS, and (ideally) configure CloudFront to use the S3 REST API origin with an Origin Access Control (OAC) so the S3 objects do not need to be publicly readable.

When to use S3 static website hosting

  • Use S3 static hosting for purely static websites, marketing pages, documentation, and single-page applications (SPAs).
  • Use CloudFront in front of S3 when you need:
    • HTTPS for custom domains
    • Global caching for lower latency
    • Private content delivery with restricted S3 access

Quick summary

  • Amazon S3 can host static websites (HTML/CSS/JS/assets) and serves them over an HTTP website endpoint.
  • It does not run server-side code—use compute services for dynamic backend logic.
  • Costs include standard S3 storage and egress plus a small per-request fee for website endpoint requests.
  • S3 provides a website URL when hosting is enabled. For custom domains the bucket name must match the domain exactly and use CloudFront + ACM if you need HTTPS and restricted bucket access.
A presentation slide titled "Summary" with four numbered points about hosting static websites on Amazon S3. The points note S3 can't run server-side logic, has per-request charges, provides a URL, and requires the bucket name to match a custom domain.

Watch Video