I recently wanted to point a domain I had registered on Namecheap (www.thisurlshortenertotallyandcompletely.rocks) to a static site I was hosting on Amazon S3. The whole process was fairly painless. Check it out:
- Create a new S3 bucket.
- Upload your content to the bucket.
- Add a bucket policy to allow anonymous read access to all objects in the bucket:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AddPerm",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::www.thisurlshortenertotallyandcompletely.rocks/*"
}
]
}
- Enable website hosting on the bucket. Save the endpoint generated for you. You’ll need this to set up your Namecheap CNAME alias.
- Browse to the alias and make sure that your site is working as expected.
- Now on Namecheap, select the domain you want to link to your S3 bucket.
- Go into “All Host Records”.
- Add a CNAME alias to the endpoint of your bucket.
- Have a beer.
I hope that helps.