Static Website Hosting on AWS S3

Last Updated : 10-Oct-2020

When you configure your bucket as a static website, the website is available at the AWS Region-specific website endpoint of the bucket. Website endpoints are different from the endpoints where you send REST API requests.

Depending on your Region, your Amazon S3 website endpoint follows one of these two formats.

  • s3-website dash (-) Region ‐ http://bucket-name.s3-website-Region.amazonaws.com
  • s3-website dot (.) Region ‐ http://bucket-name.s3-website.Region.amazonaws.com

Restrictions

Amazon S3 website endpoints do not support HTTPS. For information about using HTTPS with an Amazon S3 bucket.

Requester Pays buckets do not allow access through the website endpoint. Any request to such a bucket receives a 403 Access Denied response.

Adding a DNS CNAME

If you have a registered domain, you can add a DNS CNAME entry to point to the Amazon S3 website endpoint. For example, if you registered the domain www.example-bucket.com, you could create a bucket www.example-bucket.com, and add a DNS CNAME record that points to www.example-bucket.com.s3-website.Region.amazonaws.com. All requests to http://www.example-bucket.com are routed to www.example-bucket.com.s3-website.Region.amazonaws.com.

Key differences between a website endpoint and a REST API endpoint

An Amazon S3 website endpoint is optimized for access from a web browser. The following table summarizes the key differences between a REST API endpoint and a website endpoint.

Key difference REST API endpoint Website endpoint
Access control Supports both public and private content Supports only publicly readable content
Error message handling Returns an XML-formatted error response Returns an HTML document
Redirection support Not applicable Supports both object-level and bucket-level redirects
Requests supported Supports all bucket and object operations Supports only GET and HEAD requests on objects
Responses to GET and HEAD requests at the root of a bucket Returns a list of the object keys in the bucket Returns the index document that is specified in the website configuration
Secure Sockets Layer (SSL) support Supports SSL connections Does not support SSL connections

 

Using Template: Template Post
magnifier linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram