

Host Your Static Website on Amazon S3 - soamv
http://aws.typepad.com/aws/2011/02/host-your-static-website-on-amazon-s3.html

======
petercooper
Couple this with tools like Jekyll or nanoc (with JavaScript-powered comments,
perhaps) and you can easily roll out powerful static sites that are dynamic
locally. I can see this getting a lot of use because it makes it so easy to
rig up new sites right from the shell. It was already _pretty_ easy but the
ability to create a new "site" by merely creating a bucket on S3 reduces the
friction even more.

(Perhaps too easy, even.. Rig up a domain registration API, content generator,
and an S3 uploader and you could have a script pumping out auto-generated
"content" sites all day without any hassles right from your terminal window.)

~~~
Smerity
I think for many personal websites Jekyll[1] style static website generation
is going to become very popular. Previously you were always limited by a few
dynamic parts of your site such as comments, newsletter registration and
questionnaires but now between services like Disqus, MailChimp and Google
Docs, you really don't need to pay for any of that anymore. All the dynamic
parts of your site are external.

The only cost now is hosting the website at S3 and those costs are
substantially lower than competitors. NearlyFreeSpeech[2] is the closest web
host to S3 that I can think of and their prices for storage are $10/GB ($0.01
per megabyte month) whilst S3 starts at $0.140 per GB. If your site gets hit
incredibly heavily Amazon S3 will also handle the load transparently. If you
find that your site is becoming popular in Europe or Asia than it's also
supremely easy to push your site from S3 to CloudFront.

I wonder how far you can take this though? How complex a site can you set up
using only static hosting and external dynamic services like Disqus, MailChimp
and Docs?

[1] <https://github.com/mojombo/jekyll/wiki> [2]
<https://www.nearlyfreespeech.net/services/hosting>

[EDIT] As TeHCrAzY said I ovestated the cost of bandwidth transfer but whilst
bandwidth falls rapidly it still falls slower than S3 (at ~10TB of transfer it
approaches S3's starting price). More importantly I realised I undestated the
cost of storage - it's $10/GB and not $1/GB making it closer to 100 times more
expensive than S3.

~~~
ido

        Previously you were always limited by a few dynamic 
        parts of your site such as comments, newsletter 
        registration and questionnaires but now between 
        services like Disqus, MailChimp and Google Docs, 
        you really don't need to pay for any of that 
        anymore. All the dynamic parts of your site are 
        external.
    

Is there any good external forum system (google group isn't it due to spam)?

~~~
lt_kije
You can just use HN with my little Ycomments hack:

<http://will.m.aier.us/ycomments>

------
bigiain
You've been able to do this for a while now with CloudFront serving your S3
buckets - I'd suggest the few extra cents per month for the CloudFront CDN
service is probably a better way of managing static Amazon hosted sites...

(curiously, the domain name I experimented with this on late last year is
strangely appropriate here: <http://www.damhik.com/> )

~~~
sharth
That's not entirely true. With cloudfront, you were able to set that when you
goto <http://example.com> that it would send you to
<http://example.com/index.html>. However, it would not support you when you
accessed <http://example.com/dir/>. That would not redirect to
<http://example.com/dir/index.html>.

------
juddlyon
That sound you hear is the collective groan from every oversold cheapo shared
hosting company owner.

Unlimited hosting for 5 bucks? How's world class with a CDN for 45 cents?

~~~
pjscott
Plus, Amazon doesn't say "unlimited" and then turn around and say "haha oops
there are pretty low limits after all!" when you get Slashdotted. Their
pricing is transparent. The cheapo shared static hosting providers are now
officially the living dead.

~~~
spitfire
Unless they rebuild their cheap static hosting company on top of s3 with some
value add. Worked for heroku very nicely.

------
jonstjohn
Are cheap static sites really that big of a break-through? Whether a site is
50 cents a month through Amazon or $20/month for dozens through Linode (with
the option of non-static), doesn't seem to matter that much to me when most
people spend well over $20/week for coffee. The lowest-paid programmer in the
US can make $20 in an hour. Anyways, love all the services that Amazon puts
out and this is definitely a nice option, but I don't see it as exciting news
on an individual basis. Anybody agree?

~~~
pdx
Agreed. I think it's less about cost, and more about scaling. Not to have to
worry about scaling is interesting.

~~~
jonstjohn
Definitely, I can see the potential, particularly in terms of building
services on top of this feature. Will be interesting to see how it is
leveraged.

------
michaelbuckbee
I think is this bigger news than it seems as this enables many other new
services to now be built on top of S3.

~~~
petervandijck
Yep. Just wait until Dave Winer gets going with this :)

~~~
cstuder
He already is on it:
[http://scripting.com/stories/2011/02/17/howToMapADomainToAnS...](http://scripting.com/stories/2011/02/17/howToMapADomainToAnS3Bucke.html)

------
mleonhard
It's still impossible to host the root domain of your website on S3/CloudFront
or serve it through an EC2 Elastic Load Balancer.

www.mycompany.com - OK mycompany.com - needs an EC2 instance and Elastic IP

This is because the only way to point your domain at Amazon is with a CNAME
record and DNS does not support default CNAME records. It can only work if you
add your CNAME record to the 'com.' top-level domain, which is impossible. See
<https://forums.aws.amazon.com/thread.jspa?threadID=32044>

~~~
speleding
That is easily solved by doing a permanent redirect (301) from mycompany.com
to www.mycompany.com. Many DNS providers such as Godaddy.com have a free
redirect service just for that purpose.

~~~
StavrosK
Do they? I have to look for that, I've been sending all those to a server of
mine for that purpose, but if that server goes down or shuts down or anything,
my redirects will stop working. Thanks for the info!

~~~
fierarul
See <http://www.wwwizer.com/> , hosted on EC2 btw last I checked.

~~~
mleonhard
I'm thinking of making a paid version of this, with multiple IPs in each
region. I registered rootredir.com. Are any of you interested in this? How
much would it be worth to you per month?

------
petervandijck
May I say "awesome" and "finally"? That's awesome. Finally.

~~~
pjscott
Speaking of finally, I wonder when they're going to add proper support for
"Content-Encoding: gzip". Last I checked, people would upload gzipped content
and add the Content-Encoding header on top, which is inconvenient and doesn't
support browsers that can't handle gzipped responses.

~~~
nborgo
Honest question: which browsers can't handle gzip'd responses?

~~~
intranation
IE6 has problems with cached Gzip files: basically it forgets they're Gzipped
in the cache and then drops the Content-Encoding part of the file. So it loads
garbage as far as the JS interpreter is concerned.

------
bobf
So, who is going to be the first person to create a new static hosting
provider built on top of S3?

------
StavrosK
Or use App Engine and get pretty URLs, stats, etc as well:

[https://github.com/stochastic-technologies/static-
appengine-...](https://github.com/stochastic-technologies/static-appengine-
hoster)

------
lazyjeff
Do they also give you the server logs? e.g. access.log

~~~
boctor
Yes, s3 buckets let you specify a bucket for logging and they include things
you'd expect like IP address, referrer:
[http://docs.amazonwebservices.com/AmazonS3/latest/dev/Server...](http://docs.amazonwebservices.com/AmazonS3/latest/dev/ServerLogs.html)

------
todd3834
So now you could build a pretty serious web application with frameworks like
Backbone.js and host it for pennies, very cool.

------
sudonim
I ported my site to jekyll last night and moved to S3 for hosting. Then I
realized that my .htaccess file wouldn't work so I couldn't redirect some
links I wanted to keep.

I'm mostly a product guy, and the entire experience of setting up jekyll was
exhilarating.

S3 was pretty easy to set up for hosting.

[http://iamnotaprogrammer.com.s3-website-us-
east-1.amazonaws....](http://iamnotaprogrammer.com.s3-website-us-
east-1.amazonaws.com/)

But, I moved the site back to linode for htaccess to work.
<http://iamnotaprogrammer.com>

------
delackner
Maybe this is a good place to ask about an idea I've been toying with, but I'm
not sure about the security implications of.

I have an app that generates user content, little chunks of audio. I don't
want to get into running some server infrastructure just to let users share
their content on facebook/twitter/... so what about letting the app upload an
html file to an s3 bucket, with the data embedded in the file and a bit of
javascript for an audio player UI? Practical?

~~~
StavrosK
If the html file is self-contained, sure. Basically, if you can serve it from
a static directory and have it work, it'll work on S3.

------
nfriedly
<http://sociablelabs.com> has been doing this for a little while now and I've
been pretty happy with the performance,

------
cvk
This could be useful if your site has an extended outage one day. Create a
bucket called "mysite.com" and another called "www.mysite.com" and put your
failwhale page in it (set to be the root page). If your site goes down and you
know it will be down for an extended period (ouch), you can change your
domain's DNS entries to point to s3.amazonaws.com. Then at least your
customers will have an explanation.

------
laktek
It would be great if someone could build a routing service (ala .htaccess on
the cloud), so that we can make use of S3 without breaking the URLs.

------
nivertech
How's www.mydomain.com vs. mydomain.com handled?

Do I need to create two S3 buckets with duplicated content?

~~~
todd3834
Its pretty easy to redirect mydomain.com to www.mydomain.com (or the other way
around) through your domain registrar these days.

~~~
treitnauer
...or you have your domain registrar doing the redirection for you
automatically when setting up the DNS for S3:

[http://iwantmyname.com/services/developer/setup-custom-
domai...](http://iwantmyname.com/services/developer/setup-custom-domain-
amazon-s3)

------
corin_
This is awesome, _but_ there is one thing I wish could be changed.

I currently host my (Jekyll-powered) site with S3/CloudFront. The error pages
is awesome, but it only works if accessed through S3, not CloudFront.

~~~
JoachimSchipper
The article talks about custom 4xx error pages - what more do you need?

~~~
corin_
If your site is accessed through CloudFront, those custom error pages don't
come into effect... as I clearly said.

------
davidcann
This is perfect for auto-scaled hosting a Cappuccino app, so the server
cluster can be focused only on the backend.

------
amysue
it's almost a CouchApp :) <http://couchapp.org/page/what-is-couchapp>

------
nika
I gotta give Amazon props for extending their products along the lines that
their customers clearly want. The only problem is, given the wikileaks affair,
I don't trust them.

Maybe this is silly. It is certainly not like they're likely to pull down any
of my stuff. And I do have some largish files hosted there for convenience,
but I'm wary about becoming dependent on them in any way.

(Wikileaks was hosting their webpage on amazon, not the leaked cables
themselves. Amazon pulled their account without having gotten a court order or
giving them any warning, and they weren't hosting anything illegal there
anyway.)

~~~
jayzee
I am not an Amazon supporter but come on, do you think if you were hosted on
any other US service, rackspace or what have you, that they would keep hosting
you while the us govt was pressuring them to shut you down?

~~~
nika
Thats the thing about integrity. You never know if someone has it until it is
tested.

This same question could be asked about any hosting company that hasn't been
presented with such a request.

I'd be interested in hearing about hosting companies that have, and that stood
up to them.

The US is supposed to be a country of rule of law. They should need to get a
court order.

~~~
danshapiro
Dreamhost has a reputation for being pro-free-speech, and there are some
anecdotes online that support this. Their TOS are also on the more friendly
side, from what I've seen. I've also been quite pleased with their hosting in
every other respect.

(disclaimer: founder is an old college friend)

------
expertio
Exactly!

Sometimes I just want to create some static pages, but I was forced to use
either CMS or things like wordpress.

Now I guess there is a solution which is also super reliable.

AWS is just amazing.

~~~
requinot59
_> Sometimes I just want to create some static pages, but I was forced to use
either CMS or things like wordpress._

Wtf?! To create static pages, I open Emacs and type there. No need of a CMS or
Wordpress to create an HTML page!

Then to host it:

    
    
      scp page.html me@srv.com:~/public_html/
    

and you're good to go.

Hosting a website on S3 is nice, but it's not simpler than what is already
possible if you own a server. If you don't already own one, I'm not sure
setting up an AWS account + client code is easier than creating a new VPS
account. I surely would prefer to set up a Linux VPS, which is an environment
I'm confortable with.

Regarding the costs, I rent one private (not virtual) server for 20
euros/month, and host several (static and dynamic) sites on it, so it's
actually cheaper than going the AWS road. Uptime last time I logged: 560 days
(aka reliable enough for me).

~~~
alextgordon
You misunderestimate the ineptitude of unwitting sysadmins such as myself. It
takes me days to set up a VPS. It took me a good few weeks to figure out how
to get Django working. I screwed up my latest VPS so badly that I had to scrap
the thing and start again.

Some people really suck at these things.

 _> Regarding the costs, I rent one private (not virtual) server for 20
euros/month, and host several (static and dynamic) sites on it, so it's
actually cheaper than going the AWS road. Uptime last time I logged: 560 days
(aka reliable enough for me)._

S3 will cost literally pennies for hosting a simple static website. A VPS is
orders of magnitude more expensive.

------
anemitz
s3 is the new geocities:P

------
scalyweb
As entrepreneurs at what point do you decide that Amazon is "too big" and do
you decide to stick with smaller service providers? Is your use of Amazon
strictly a commodity provider?

~~~
jpadvo
What do you mean by "too big"? I guess what I'm wondering is what about that
would motivate switching to smaller providers.

~~~
scalyweb
This probably deserves a separate discussion.

As an entrepreneur do you also use other entrepreneur's/start-up's services or
just rely on the big (market share) players in the market? A startup is hard
so do you go out of your way to help support other smaller service providers?

If you have an opportunity to support competition in the marketplace by not
flocking to the lowest price(Walmart) but paying a bit more for a smaller
service, do you make that sacrifice?

Knowing that NearlyFreeSpeech.Net appears to offer similar functionality, why
choose a larger provider like Amazon if you have the mindset of a founder?

~~~
tptacek
No part of the mindset of a founder requires you to select inferior
alternatives out of empathy for the people who provide them.

------
wickedchicken
This is nuts. It's nice to see the internet being increasingly commoditized --
hell, Amazon has commoditized _people_.

