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.
Short description
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 S3 website endpoints. For REST API endpoints by Region, see Amazon S3 endpoints.
Resolution
Follow these steps to find your bucket's website endpoint:
- Open the Amazon S3 console.
- From the bucket list, choose the bucket that you're using to host the static website.
- 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:
- Open the CloudFront console.
- From the distribution list, choose the distribution associated with your S3 bucket.
- From the General view, choose Edit.
- For Default Root Object, enter the object name of your index page (for example, "index.html").
- Choose Yes, Edit.
Related information
Key differences between a website endpoint and a REST API endpoint