The Amazon S3 object store service and be used for web hosting for static web pages.

Hosting a Static Website on Amazon S3

First of all, we need a new S3 bucket for this web site, and the name has to be unique in all of S3.

And if you want your own domain name to point to this S3 bucket, then the domain name and the bucket name must be exactly the same.

Second, you must use Amazon Registrar and Route 53 to serve content from your root domain.

aws s3 mb s3://houston-aws-wol.com --region us-east-1

Amazon says

make_bucket: s3://houston-aws-wol.com

Repeat for the www variation.

aws s3 mb s3://www.houston-aws-wol.com --region us-east-1

Upload this content using the aws s3 copy or sync command.

aws s3 cp index.html s3://houston-aws-wol.com

or

aws s3 sync --delete ./ s3://houston-aws-wol.com

The sync command is a wrapper for the Rsync utility, so you must have that installed.

Set the S3 bucket as a web site.

aws s3 website s3://houston-aws-wol.com/ --index-document index.html --error-document error.html

aws s3api put-object-acl --bucket houston-aws-wol.com --key index.html --grant-read uri=http://acs.amazonaws.com/groups/global/AllUsers

Allows anybody to access the index page of the web site, but not any other files that you put in that bucket.

A better way is to put this policy into a file (s3-website.json), and then execute it as a bucket policy.

cat s3-website.json

{
"Version":"2012-10-17",
"Statement":[{
"Sid":"AddPerm",
"Effect":"Allow",
"Principal": "*",
"Action":["s3:GetObject"],
"Resource":["arn:aws:s3:::houston-aws-wol.com/*"
]
}
]
}

aws s3api put-bucket-policy --bucket houston-aws-wol.com --policy file://s3-website.json

Make the www version of the S3 bucket redirect to the normal web site.

cat s3-website-redirect.json

{
"RedirectAllRequestsTo": {
"HostName": "houston-aws-wol.com"
}
}

aws s3api put-bucket-website --bucket www.houston-aws-wol.com --website-configuration file://s3-website-redirect.json

Make our www version of the domain name link to our domain name via DNS.

cli53 rrcreate houston-aws-wol.com www CNAME houston-aws-wol.com

Amazon says

Success
ChangeInfo:
Status: PENDING
SubmittedAt: 2015-11-28T21:23:23.856Z
Id: /change/C3F1IOGAF3RELW

aws route53 get-change --id C3F1IOGAF3RELW

Amazon says

CHANGEINFO /change/C33PDI7KUZ682 INSYNC 2015-11-28T21:31:46.431Z

and the INSYNC means the change has been propagated.

We should now be able to see the same content at both versions of the web site.

http://houston-aws-wol.com

http://www.houston-aws-wol.com