Register a domain with Route 53
Route 53 is the AWS-service for registering and managing domains. For registering and moving domains into Route 53, AWS hands over the requests to the registrar Gandi, which is located in Paris, Luxembourg, San Francisco and Taipei. The actual content of a domain is managed within Route 53, if the nameserver-entries for the domain point to specific AWS-nameservers.
To be honest, other hosters or ISPs also do that, too. However, in this blog-post I will show you, why Route 53 is not just only registering and managing domains like at any other hoster.
Registering a domain within Route 53 is quite affordable compared to other providers. In the USA, the registrar GoDaddy is one of the big players. In Germany, I would chose United Domains, as they - same as Route 53 - offer a big range of available TLDs. Therefore, I compared the three of them concerning their prices in USD per year for one domain and availability of TLDs.
|Provider||No. of TLDs|
First, you need to check, if the new domain is still available. This can be done with following command.
If you get the error message Could not connect to the endpoint URL: “https://route53domains.eu-central-1.amazonaws.com/”, it could be that your configured default region has no support for the needed services. In order to use this service, you need to set your default region to e.g. us-east-1, create a new aws-cli profile explicitly for us-east-1 or just append –region us-east-1 to your command.
As we can see, the domain aws-blog.io as expected is already taken. So you can try for another domain and the output would look like this.
Now that we have found a free domain-name, we can start registering it. We first create a cli-skeleton for the parameters.
After the export of the sekeleton-code, we can update the parameters accordingly. When the editing is done, we can run the registration command.
As the return code of the command, we get an opration id. We can now check the status of our registration process, as this may take some time.
After the domain had been successfully registered, the response now looks like the following.
Management of Domains
The management of the domains within Route 53 can be done with plain aws-cli. However, there’s another cli which sits on top of aws-cli for handling Route 53 in an easier way. That cli is called cli53. The installation can be done via pip.
With cli53 being installed, we can now create the first recordset in the hosted zone of our domain. The following command for example creates a mapping of www.aws-is-cool.de to 126.96.36.199.
In order to delete the created recordset again, you just need to run the next command.
Backup the DNS-config
A backup of all recordset of a domain can be very usefull, in case anything goes wrong. With cli53 you can easily export a domain in bind-format and afterwards import it again.
export single domain
export all domains
import single domain
With the above code, a less risky way of domain-import is being done. If you don’t want to, you can also leave out –replace –wait from the command.
In order to explain the concept of alias-entries I took the following architecture.
The steps for creating the recordsets for the concept are
- find the ID of the Hosted Zone.
- create entry for tim.aws-blog.io to 10.0.0.1
- create entry for struppi.aws-blog.io to 10.0.0.2
- create alias entry for aws-blog.io to tim.aws-blog.io
- create alias entry for staging.aws-blog.io to tim.aws-blog.io
- create alias entry for dev.aws-blog.io to struppi.aws-blog.io
Thanks to cli53, this can be done with the following few commands.
The nice thing of this concept is that whenever tim or struppi need to change their IP-address, they don’t need to get changed for all referencing entries, but only for the non-alias entry.