14 October 2022

Getting a domain for your CloudFront web/site/distribution.


Getting a domain for your CloudFront web/site/distribution.


First of all, you have to decide if you prefer


Something to read about that:

https://stackoverflow.com/questions/63994761/how-to-run-cloudfront-without-route-53
https://blog.codinghorror.com/the-great-dub-dub-dub-debate/


If you want to take Option_A, you will need a DNS server able to do 'CNAME flattening' (also called 'CNAME Alias') ( Route53, CloudFlare, Porkbun), otherwise most DNS will do.



1. Choose domain

There are lots of TLDs (Top Level Domains) to use.
https://tld-list.com/
They have different price-ranges.


2. Purchase domain

Using https://tld-list.com you can explore the purchase price (over years) for different 'domain registrar' companies.

If you want to 'move the domain' to another provider, you need to wait 60 days after purchase or changes.

However, if you just want to modify the DNS, no need to move anything.


3. Getting CloudFront to use your domain.

These two explain it very well.
https://dev.to/namuny/integrating-aws-cloudfront-with-third-party-domain-provider-2ce3
https://advancedweb.hu/how-to-use-a-custom-domain-on-cloudfront-with-cloudflare-managed-dns/

Use this for ACM > https://us-east-1.console.aws.amazon.com/acm/home?region=us-east-1#/welcome


Along the way you may want this
https://docs.aws.amazon.com/acm/latest/userguide/acm-regions.html
https://docs.aws.amazon.com/acm/latest/userguide/dns-validation.html
https://aws.amazon.com/premiumsupport/knowledge-center/acm-certificate-pending-validation/
https://docs.aws.amazon.com/acm/latest/userguide/domain-ownership-validation.html
https://aws.amazon.com/blogs/security/easier-certificate-validation-using-dns-with-aws-certificate-manager/


Once you have changed the configuration on the DNS, you can verify it with
https://www.digwebinterface.com

And then wait for ACM to display 'Issued'

Once you have the Certificate, follow the instructions on any of the 2 webs above to do changes in CloudFront.

IF you were using Cognito, there is some more work to do

https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-add-custom-domain.html

You may only add the origin & destination host (the nice public domain) for calls to / from Cognito.
Or you could go much further and also make Cognito url to use your domain name.

=================


Personal Choices

I decided
domain.xyx > redirect to > www.domain.xyz
So I didn't need the 'CNAME flattening'

I purchased the domain and configured the DNS with 'porkbun'
https://kb.porkbun.com/article/85-how-to-connect-your-root-domain-when-your-web-host-wont-provide-an-ip-address
It worked just fine.

I didn't need Cloudflare / Route53.

I created this small bash script

routing () {
wget "$1" 2>&1 | grep Location;
}

so I could check all with:

routing domain.xyz


I hope it helps.

0 Comments:

Post a Comment

<< Home

Too Cool for Internet Explorer