Hosting a Static Website on Amazon S3
Topics
You can host a static website on Amazon S3. On a static website, individual web pages include static content. They may also contain client-side scripts. By contrast, a dynamic website relies on server-side processing, including server-side scripts such as PHP, JSP, or ASP.NET. Amazon S3 does not support server-side scripting.
Note
Amazon Web Services (AWS) has resources for hosting dynamic websites. To learn more about website hosting on AWS, go to Websites and Website Hosting.
To host your static website, you configure an Amazon S3 bucket for website hosting and then upload your website content to the bucket. The website is then available at the region-specific website endpoint of the bucket:
<bucket-name>.s3-website-<AWS-region>.amazonaws.com
For a list of region specific website endpoints for Amazon S3, see Website Endpoints. For example, suppose you create a bucket called
examplebucket
in the US East (N. Virginia) Region and configure it as a
website.
The following example URLs provide access to your website content:
This URL returns a default index document that you configured for the website.
http://examplebucket.s3-website-us-east-1.amazonaws.com/
This URL requests the photo.jpg object, which is stored at the root level in the bucket.
http://examplebucket.s3-website-us-east-1.amazonaws.com/photo.jpg
This URL requests the
docs/doc1.html
object in your bucket.http://examplebucket.s3-website-us-east-1.amazonaws.com/docs/doc1.html
Using Your Own Domain
Instead of accessing the website by using an Amazon S3 website endpoint, you can use your
own domain, such as example.com
to serve your content. Amazon S3, in conjunction
with Amazon Route 53, supports hosting a website at the root domain. For example if you have
the root domain example.com
and you host your website on Amazon S3, your website
visitors can access the site from their browser by typing either
http://www.example.com
or http://example.com
. For an
example walkthrough, see Example: Setting Up a Static Website
Using a Custom Domain.
To configure a bucket for website hosting, you add website configuration to the bucket. For more information, see Configure a Bucket for Website Hosting.