Reputation: 38878
Is there a way to make S3 default to an index.html page? E.g.: My bucket object listing:
/index.html
/favicon.ico
/images/logo.gif
A call to www.example.com/index.html works great! But if one were to call www.example.com/ we'd either get a 403 or a REST object listing XML document depending on how bucket-level ACL was configured.
So, the question: Is there a way to have index.html functionality with content hosted on S3?
Upvotes: 39
Views: 33129
Reputation: 469
Since It's been long time, this question being asked, and Amazon S3 changing their Interface. I would like to answer with updated screenshots.
We need to enable 'static web hosting' for S3 to serve as web hosting.
- Go to Properties -> click on static web hosting -> Select 'use this bucket to host a website'
- Enter the index document (index.html by default), error document and redirection rules, if any.
As answered in this answer on Stack Overflow, web hosting link would be: http://bucket-name.s3-website-region.amazonaws.com
Upvotes: 3
Reputation: 12159
For people still struggling against this after 3 years, let me add some important information:
The URL for your website (and to which you have to point your DNS) is not
<bucket_name>.s3-us-west-2.amazonaws.com
, but
<bucket_name>.s3-website-us-west-2.amazonaws.com
.
If you use the first, it will not work as intended, no matter how much you config the Index document.
For a specific example, consider:
AccessDenied
.To get your true website address, go to your S3 Management Console, select the target bucket, then Properties
, then Static Website Hosting
. It will show the website URL that will work.
Upvotes: 82
Reputation: 39496
Amazon S3 now supports Index Documents
The index document for a bucket can be set to something like index.html
. When accessing the root of the site or a sub-directory containing a document of that name that document is returned.
It is extremely easy to do using the aws cli:
aws s3 website $MY_BUCKET_NAME --index-document index.html
You can set the index document from the AWS Management Console:
Upvotes: 37
Reputation: 7744
You can easily solve it by Amazon CloudFront link. At Amazon CloudFront you could modify the root object. You can download manager here: m1.mycloudbuddy.com/downloads.html.
Upvotes: 4
Reputation: 1
you can do it using dns webforwards and cloaking. just forward to the complete path of the index.html
www.example.com forwards to http://www.example.com.s3.amazonaws.com and make sure you cloak the output.
Upvotes: 0
Reputation: 21213
I would suggest reading this thread from 2006 (On Amazon web services developers connection). It seems there's no easy solution to this.
Upvotes: 2