S3 Static Website Hosting URL

Parse the special URL format used when S3 buckets are configured for static website hosting. Understand the differences from standard S3 endpoints.

Practical Patterns

Detailed Explanation

S3 Static Website Hosting Endpoints

When a bucket is configured for static website hosting, S3 provides a special website endpoint that behaves differently from the standard REST API endpoint.

Website Endpoint Format

http://BUCKET.s3-website-REGION.amazonaws.com
http://BUCKET.s3-website.REGION.amazonaws.com

Note: The format uses either a dash or a dot before the region, depending on the region.

Example

http://my-blog.s3-website-us-east-1.amazonaws.com/posts/hello-world.html

Parsed Components

Component Value
Bucket my-blog
Key posts/hello-world.html
Region us-east-1
Type Website Endpoint

Website vs REST Endpoint Differences

Feature REST Endpoint Website Endpoint
HTTPS Supported HTTP only (use CloudFront for HTTPS)
Index documents Not supported Serves index.html for / paths
Error documents XML error responses Custom error pages (e.g., 404.html)
Redirects Not supported Supports redirect rules
ListBucket Returns XML listing Returns 403 (no directory listing)
URL format s3.amazonaws.com s3-website.amazonaws.com

CloudFront Integration

In production, you typically put CloudFront in front of the website endpoint to provide:

  1. HTTPS — Website endpoints only support HTTP.
  2. Custom domain — Map your domain to the CloudFront distribution.
  3. Caching — Reduces S3 request costs and improves latency.
  4. Geographic routing — Serves content from edge locations.

CloudFront origin:

my-blog.s3-website-us-east-1.amazonaws.com

Important: Use the website endpoint as the CloudFront origin (not the REST endpoint) if you need index document and redirect behavior.

Common Configuration

{
  "IndexDocument": { "Suffix": "index.html" },
  "ErrorDocument": { "Key": "404.html" },
  "RoutingRules": [
    {
      "Condition": { "KeyPrefixEquals": "old/" },
      "Redirect": { "ReplaceKeyPrefixWith": "new/" }
    }
  ]
}

Use Case

Migrating a static website from direct S3 website hosting to CloudFront, ensuring the correct S3 website endpoint is used as the origin to maintain index document and custom error page behavior.

Try It — AWS S3 URL Parser

Open full tool