Brad Lucas

Programming, Clojure and other interests
August 8, 2017

S3 Website Hosting

You can host a static web site simply using a S3 bucket. To do so create your bucket and select it in the AWS console.

Properties

Select properties tab and then click on the 'Static website hosting' box. When prompted note the end point as this will be the url to your site. Then select 'Use this bucket to host a website'. Enter the appropriate index document. Typically, it will be index.html but if you have a different default page enter it here and save the prompt.

Permissions

Select the permissions tab and then click on the 'Bucket Policy' button. Here you will want to add a new policy. Use the following template and replace <YOUR BUCKET HERE> with the name of your bucket.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "PublicReadGetObject",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::<YOUR BUCKET NAME HERE>/*"
        }
    ]
}

Review

At this point you should be able to try the end point your noted above.

Tags: aws s3