Cloudflare is great, I've been using them as my DNS manager and CDN for years and they offer a lot of value even on the free tier, they also have very competitive domain registration pricing, but... you can not point your domains bought on Cloudflare to other CDNs like AWS CloudFront or even to other Nameservers ☹️

So to use AWS CloudFront I will transfer my domain from Cloudflare to another provider, because the price difference is not significant, I will move them to AWS Route53.

Before we transfer / move the domain to Route53, let's create a Hosted zone so that on the domain migration fase we can select this zone

module "zones" {
   source  = "terraform-aws-modules/route53/aws//modules/zones"
   version = "~> 2.0"

   zones = {
     "awsary.com" = {
       comment = "awsary.com"
     }
   }
 }

 module "records" {
   source  = "terraform-aws-modules/route53/aws//modules/records"
   version = "~> 2.0"

   zone_name = keys(module.zones.route53_zone_zone_id)[0]

   records = [
   ]

   depends_on = [module.zones]
 }

Records array will be filled in the future with any record we want to create.

In the meanwhile, I did not found a way to register domains in Route53 with terraform, only to manage them after transfer is done via the AWS Web Console, so let's do it.

  1. On Cloudflare, search for the domain.

2. Then on "configurations" tab, look for "unlock" transfer button.

3. Confirm unlock.

4. Copy the transfer code

§

5. On AWS Web Console, browse to Route53 service, select "Registered Domains" on the left column and then "Transfer Domain".

6. Type your domain name, "Check" for availability to transfer, then "Add to Cart" and finally "Continue".

7.

8. Add your WhoIs personal contacts data.

9. Validate everything and "Complete Order".

10. Now it's just a question of waiting a few minutes.

Done! Next we can go on and configure CloudFront and point it to our domain! 🥳