One usecase is SSL enabled static site hosting for any new domains. Another is redirecting SSL enabled traffic from one domain to other locations.
- Register the new domain name (ie. somedomain.com) with AWS Route53.
- Create a new bucket for hosting static site www.somedomain.com on AWS S3. See permissions below.
- Create a new index.html file and place it in the newly created bucket, make it public.
- Register a new SSL certificate for the new domain name with AWS Certificate Manager.
- Create a new CDN distribution for the new domain on AWS Cloudfront using the newly issued SSL certificate.
- Create a DNS A record for www.somedomain.com to alias newly created Cloudfront CDN address.
- Create a DNS Pointer record for root level somedomain.com to point to www.somedomain.com
- Wait for CDN propagation, check if non-secure http://somedomain.com redirects to SSL enabled https://www.somedomain.com
- If SSL enabled domain redirection is the goal provide redirect map on the S3’s www.somedomain.com folder, see below.
Let buckets grant read access to your files.
{ "Version": "2012-10-17", "Statement": [ { "Sid": "AddPerm", "Effect": "Allow", "Principal": { "AWS": "" }, "Action": "s3:GetObject", "Resource": "arn:aws:s3:::www.somedomain.com/" } ] }
Redirect incoming requests for any path to a single page
403 https www.redirect.com redirect/me/here/please/thank-you 302