Saturday, January 19, 2013

Amazon S3 Static Sites

A friend of mine recently asked about hosting a simple static site for his business.  There are lots of places that will do virtual hosting for you, but he really just wanted a simple single page site for his business.  I remembered that Amazon recently enabled static website hosting using their S3 service, so I figured I would give it a try.

Pretty much just had to follow the instructions on this tutorial page.  I didn't do the redirect business since I only had one domain name, not two.  Also, it was easy for me since I already have a custom domain service at Dyn.


Logged into console.aws.amazon.com and created ab90.beguelin.com bucket.

Create a simple index.html file called ab90.html.  Uploaded it using the console.

Grant everyone open and download permissions.

Add bucket policy:

{
  "Version":"2008-10-17",
  "Statement":[{
 "Sid":"AddPerm",
        "Effect":"Allow",
   "Principal": {
            "AWS": "*"
         },
      "Action":["s3:GetObject"],
      "Resource":["arn:aws:s3:::ab90.beguelin.com/*"
      ]
    }
  ]
}


Select enable static hosting. Now go to the ab90.beguelin.com.s3-website-us-east-1.amazonaws.com site and it's there!

Create a CNAME ab90.beguelin.com that points to ab90.beguelin.com.s3-website-us-east-1.amazonaws.com and then it's done!  I now have a new static site at http://ab90.beguelin.comhttp://ab90.beguelin.com.


Post a Comment