I'm using an Amazon Simple Storage Service (Amazon S3) bucket to host my static website. When I send a request to the bucket, I see an XML list of objects instead of the index page that I set up for my website. Why is this happening? How do I get Amazon S3 to return the index page?

Amazon S3 buckets have both a website endpoint and a REST API endpoint. Website endpoints use this format:

bucket-name.s3-website-us-west-2.amazonaws.com

REST API endpoints use this format:

bucket-name.s3-us-west-2.amazonaws.com

If you send a GET request to the bucket, you must send the request to the website endpoint so that Amazon S3 returns the index page (called the "index document" in the Amazon S3 console). If you send a GET request to the REST API endpoint, Amazon S3 returns a list of objects in the bucket.

If you use an Amazon CloudFront distribution with an Amazon S3 origin, you must also set the index page as the default root object to be sure that Amazon S3 returns the index page.

Important: Endpoints vary by AWS Region. For website endpoints by Region, see Amazon Simple Storage Service Website Endpoints. For REST API endpoints by Region, see AWS Regions and Endpoints - Amazon Simple Storage Service (Amazon S3).

Follow these steps to find your bucket's website endpoint:

  1. Open the Amazon S3 console.
  2. From the bucket list, choose the bucket that you're using to host the static website.
  3. Choose the Properties view, and then choose Static website hosting.
    The website endpoint is the value that's listed as Endpoint.

If you're using a CloudFront distribution with an Amazon S3 origin, follow these steps to set your distribution's default root object to the index page:

  1. Open the CloudFront console.
  2. From the distribution list, choose the distribution associated with your S3 bucket.
  3. From the General view, choose Edit.
  4. For Default Root Object, enter the object name of your index page (for example, "index.html").
  5. Choose Yes, Edit.

Did this page help you? Yes | No

Back to the AWS Support Knowledge Center

Need help? Visit the AWS Support Center

Published: 2018-12-19