| Did this page help you? Yes No Tell us about it... |
This section walks you through the steps of hosting a website on Amazon S3. In the following procedure you use the AWS Management Console to perform the necessary tasks.
![]() | Important |
|---|---|
In this section, we assume you are already familiar with creating and manipulating Amazon S3 buckets with the console. For more information about creating buckets, see Creating a Bucket. |
To host a simple, new website
Create a bucket and configure it as a website:
Go to the Amazon S3 console.
Create a bucket. Note the region where you created the bucket. In this procedure you create a bucket in the US Standard region.
If you have your registered domain name, for additional information about bucket naming, see Customizing Amazon S3 URLs with CNAMEs and Customizing Amazon S3 URLs with CNAMEs.
In the bucket Properties pane, click the Website configuration tab.
Select the Enabled check box.
In the Index Document text box, add the required index document name (index.html). Instructions to upload your index document are provided in the following steps.
Click Save to save the website configuration.
Add a bucket policy to make your bucket content publicly available.
The content you want to served via the website endpoint must be publicly readable. You can grant the necessary permissions by adding a bucket policy or by changing each object's ACL. Here we describe adding a bucket policy.
In bucket Properties pane, click the Permissions tab.
Click Add Bucket Policy.
Copy the following bucket policy and paste it in the Bucket Policy Editor.
{
"Version":"2008-10-17",
"Statement":[{
"Sid":"PublicReadForGetBucketObjects",
"Effect":"Allow",
"Principal": {
"AWS": "*"
},
"Action":["s3:GetObject"],
"Resource":["arn:aws:s3:::example-bucket/*"
]
}
]
}Update the policy by providing your bucket name, instead of the example-bucket.
Click Save.
Upload an index document.
Amazon S3 serves this index document whenever a user specifies the URL for
the root of your website, or a subfolder. For example, when a customer requests
http://example-bucket.s3-website-us-east-1.amazonaws.com/,
Amazon S3 returns the content of your index document at the root of the website,
http://example-bucket.s3-website-us-east-1.amazonaws.com/index.html.
Create a document.
The file name (index.html) must be same as the Index Document you provided when configuring your bucket as a website in the preceding steps.
Using the console, upload the index document to your bucket.
For information on uploading an object, go to Uploading Objects into Amazon S3.
Test your website.
Enter the following URL in the browser. Specify your bucket name and the region specific endpoint name (see Website Endpoints ).
This is the URL to the root of your website. In response, Amazon S3 returns the index.html page you added to the bucket.
http://example-bucket.s3-website-region.amazonaws.com
![]() | Note |
|---|---|
HTTPS access to the website is not supported. |
You now have a website hosted on Amazon S3.
The preceding section provides you a step-by-step procedure to configure a bucket as a website using the AWS Management Console. This section outlines the key website features and where you can learn more about these features.
Website Endpoints
There are region-specific website endpoints available for accessing websites hosted on Amazon S3. It also describes how the website endpoint differs from the RESTAPI endpoint. For more information, see Website Endpoints.
Configure Your Bucket as a Website
You can manage your website configuration using the AWS Management Console, any of the AWS SDKs, or a number of third party tools and libraries. For more information, see How Do I Configure My Bucket As a Website?.
Index Document Support
Amazon S3 supports index documents at the root of the website as well as for subfolders. For more information, see Index Document Support.
Custom Error Document Support
Should an error occur on the website endpoint, Amazon S3 returns an HTML error document. You can optionally provide a custom error document for Amazon S3 to return when any HTTP 4XX class response code occurs. For more information, see Custom Error Document Support.