Working with Amazon Route53 and DNScurl
8/30/2011 08:30:00 PM
Posted by johnhomer
As of today, Amazon AWS does not provide console access to Route53 administration. DNS management is done thru REST API calls and a perl helper.
What you need:
- DNScurl
- AWS Access Key ID and Secret Access
1. Download and extract DNScurl.
2. Setup the credential file. Create a file named .aws-secrets and give it a 600 permission.
%awsSecretAccessKeys = ( "Account1" => { id => "AKIXXXXXXXXXXXXXXXXX", key => "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", }, );
I should mention that every request to AWS Route53 API servers should go in a form of an XML file. That is, to add DNS records, you create an XML describing the new DNS records. Now for actual DNS work.
Creating a hostedzone
A hostedzone is like creating an SOA entry in traditional DNS. We first create init.xml:
Then we submit the request like so:
$ ./dnscurl.pl --keyname Account1 -- -H "Content-Type: text/xml; charset=UTF-8" -X POST --upload-file init.xml https://route53.amazonaws.com/2011-05-05/hostedzone
Output should be something like:
This may seem overwhelming but it's actually simple. Each hostedzone belongs to a unique id as seen in ID tag (line 4). We can use the ID inside the ChangeInfo tag to check of the requested transaction has been completed already (line 12). We will discuss about checking the status of requests a bit later. You will use the name servers inside the NameServers tag to transfer control from your current DNS hosting provider to AWS Route53 (lines 18 - 21).
Checking the status of changes
The same procedure applies when adding DNS records.
$ ./dnscurl.pl --keyname Account1 -- -H "Content-Type: text/xml; charset=UTF-8" -X GET https://route53.amazonaws.com/2011-05-05/change/C4FEN46OTHN1NOutput:
Notice the value in the Status tag. INSYNC means the changes has been made and that records are synchronized among Route53's DNS servers.
Adding DNS entries
Now that that hostedzone/SOA is setup. It is time to create the DNS entries. Here is a sample XML that covers most type of DNS records for a regular domain:
Save the file as records.xml
Send the request by:
$ ./dnscurl.pl --keyname Account1 -- -H "Content-Type: text/xml; charset=UTF-8" -X POST --upload-file records.xml https://route53.amazonaws.com/2011-05-05/hostedzone/Z3DNHUN633ADSB/rrset
Subscribe to:
Posts (Atom)