Skip to content

Hosting via S3 Directly

Steve Chung edited this page Feb 4, 2019 · 5 revisions

You can host directly via S3 by making the bucket public. You will not have SSL or a CDN with this, but it's simple and easy. An alternative way is via Cloudfront.

Your S3 Bucket Name must match the domain you're hosting on. Ie. if your website is, www.stevenchung.ca, your bucket name must be www.stevenchung.ca.

In the AWS Management Console, go to your S3 bucket. Then Permissions > Bucket Policy and set the following:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "AddPerm",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::<BUCKET_NAME>/*"
        }
    ]
}

Then go to Properties > Static Website Hosting and set index.html and 404.html as your Index and Error documents. On the same page, just below the Static Website Hosting heading, there should be the text, Endpoint: <URL>, use that URL to create a CNAME record in your DNS.

Clone this wiki locally