Subscribe to receive notifications of new posts:

Zone Apex / Naked Domain / Root Domain CNAME Support for Amazon EC2, Google App Engine and Other Cloud Hosts

05/16/2011

2 min read


CloudFlare now supports CNAME Flattening, which is a better solution to this same problem. Read more in our knowledge base about RFC-compliant support for CNAME at the root.

One of the challenges of using a service like Amazon Web Services (AWS) Elastic Cloud (EC2) is you need to point your DNS to a CNAME. The problem is the DNS RFC (RFC1033) requires the "zone apex" (sometimes called the "root domain" or "naked domain") to be an "A Record," not a CNAME. This means that with most DNS providers you can setup a subdomain CNAME to point to EC2, but you cannot setup your root domain as a CNAME
to point to EC2.

In other words, you can do this:
www.yourdomain.com CNAME some-id.ec2.amazonaws.com<

But, with most DNS providers (including Amazon's own Route 53), you can't do this:
yourdomain.com CNAME some-id.ec2.amazonaws.com

You also cannot reliably point your root A Record to an IP address within the EC2 network since Amazon reserves the right to reallocate the IP address dedicated to your instance. While there are some hacks to redirect the root domain to a subdomain like "www", this limitation creates a mess many people wanting to use cloud service providers (">as evidenced by several threads on the subject).

Never one to let a RFC stand in the way of a solution to a real problem, we're happy to announce that CloudFlare allows you to set your zone apex to a CNAME. This allows CloudFlare users to host on EC2, Rackspace's Cloud, Google App Engine, or other cloud hosts and use their naked domain (e.g., yourdomain.com) without forcing a hack solution to a subdomain (e.g., www.yourdomain.com). Pick whatever host makes the most sense for you, sign up for
CloudFlare
, and we'll help ensure your site is as fast, secure, and effective as possible.

And, by the way, using CloudFlare's free service for a website hosted on EC2 typically makes the site about 50% faster worldwide while saving you about 65% off your bandwidth bill! Enjoy.

We protect entire corporate networks, help customers build Internet-scale applications efficiently, accelerate any website or Internet application, ward off DDoS attacks, keep hackers at bay, and can help you on your journey to Zero Trust.

Visit 1.1.1.1 from any device to get started with our free app that makes your Internet faster and safer.

To learn more about our mission to help build a better Internet, start here. If you're looking for a new career direction, check out our open positions.
AWSEC2Reliability

Follow on X

Matthew Prince|@eastdakota
Cloudflare|@cloudflare

Related posts