Here is the process I followed so maybe I can have some help here:
-
I registered and paid for a domain on Amazon Route 53
-
I am trying to host a static website on a S3 bucket so I created a Hosted Zone with the apex domain (
example.com
) and an alias (www.example.com
) pointing to the apex hosted zone and a record typeNS
andSOA
were created by default. -
Uploaded my webpage to S3. In properties I can access to this page trough a link
http://example.com.s3-website-us-west-1.amazonaws.com
, but this does not have SSL / TLS certificates, so the webpage is not accessible without warnings. -
To be able to use CloudFront I intended to request public SSL / TLS certificate through the AWS Certificate Manager, for
example.com
andwww.example.com
-
Now my distribution is active on CloudFront, but the domain is
someid.cloudfront.net
. I have tried a lot of things and read documentation but its confusing for me to use the domain from Route 53 to redirect it to the CloudFront domain. Any advice?
Tried to remake all the process again but I don’t know what else I need to do. I’m expecting to use the domain I registered on Route 53 to redirect it to the CloudFront distribution.
2
Answers
Use can just use Alternate domain in Cloudfront and add the url where you have to redirect it to, you can refer the below blogs
https://crishantha.medium.com/hosting-a-secure-aws-cloudfront-endpoint-via-aws-route-53-be65d42191b7
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CNAMEs.html
Follow the below steps to live your site hosted in Cloudfront (S3 as origin) through route53:
Prerequisites
Make sure you’ve added
example.com
andwww.example.com
as an alias in Cloudfront distribution origin.To do so, follow the below steps:
General
tabwww.example.com
) as alias inAlternate domain name
column, (you can add multiple domains here)Custom SSL certificate
(If you don’t have one you can request one in ACM, it’s pretty easy, and you can get it in less than 5 min)ACM Certificate Generation Checklist
us-east-1
*.example.com
(to support http://www.example.com) usingAdd another name to this certificate
Route 53 Steps
A
alias
optionRoute traffic to
field, chooseAlias to Cloud front distribution
someid.cloudfront.net
)This should work.