Setting up DNS zone with Cloudflare
Cloudflare provides 3 ways of setting up DNS Zones
In this article we are going to address only one from the above, which is the Partial CNAME setup. We use Partial CNAME setup in cases where we already have authoritative DNS provider (i.e AWS Route53) and we don’t want the Cloudflare to be our authoritative DNS provider. With Partial CNAME setup we can allow our traffic to proxy through the Cloudflare’s global edge network.
Steps for creating the Partial CNAME zone
- Add the domain
example.comto Cloudflare
- Select “add site” to create the zone
- Select plant type. e.g free, enterprise
- Once the zone is created, goto overview page and convert to partial (CNAME) zone.
- Add the Cloudflare generated
TXTrecord to theexample.comhosted zone in Route53 for authoritative domain ownership verifications. - Add CNAME record in newly created
example.comzone in Cloudflare.website.example.com CNAME xxxxxx-12345.us-east-1.elb.amazon.com - Create the
CNAMErecord at the Route53 hosted zone (authoritative DNS provider)website.example.com CNAME website.example.com.cdn.cloudflare.net
Configuring the certificates
- Make sure the CAA records are available under the authoritative DNS (Route53 Hosted Zone)
- Refer this doc for the list of CAA records to be added.
- Configuring the Edge Certificates.
- Universal Certificate - Cloudflare will automatically generate the Universal Certificate and this can be validated by creating a TXT record in the authoritative DNS provider. It is required make a API call to Cloudflare to change the validation method of the certificate.
- Advanced Certificate - Universal SSL certificates only support SSL for the root or first level subdomains such as
website.example.com. Hence, if you need to enable SSL support for 2nd, 3rd.. 4th level subdomains likeportal.website.example.com, you need to purchase an Advance Certificate, which can cover more than one sub-domain.
Finally, testing your partial CNAME setup
To test your DNS is proxying through Cloudflare, simply run a nslookup command and you should see one of the Cloudflare IP addresses in the command output.
nslookup website.example.com