How to migrate an existing DNS zone file to Amazon Route 53

Importing an existing zone file to Amazon Route 53 has historically been less than straight forward. In this example we will import an existing zone file into Route 53 using a free command line tool called cli53.

What Amazon Route 53?

Amazon Route 53 is a highly available and scalable Domain Name System (DNS) web service. Route 53 is designed to be fast, easy to use, and cost-effective. It answers DNS queries with low latency by using a global network of DNS servers. Queries for your domain are automatically routed to the nearest DNS server, and thus answered with the best possible performance.

Install cli53 dependencies

Log into an Amazon Linux instance using PuTTY and type:

sudo yum -y install python-pip*
sudo yum -y install python-boto
sudo easy_install pip

Install cli53

sudo pip install cli53

Configure cli53 security access

touch ~/.boto
vi ~/.boto

Now let’s add this to the file and add your key and access key

 aws_access_key_id = [your AWS ID]
 aws_secret_access_key = [your AWS key]

Preparing your zone file into Route 53

First, get a copy of your latest zone file, in this case we are going to use:

Now add a new line to the top of the file and add this line – remember the trailing dot


So you should get a file like this

$TTL 1h                  ; default expiration time of all resource records without their own TTL value  IN  SOA (
              2007120710 ; serial number of this zone file
              1d         ; slave refresh (1 day)
              2h         ; slave retry time in case of a problem (2 hours)
              4w         ; slave expiration time (4 weeks)
              1h         ; maximum caching time in case of failed lookups (1 hour)
              )  NS    ns                    ; is a nameserver for  NS    ns.somewhere.example. ; ns.somewhere.example is a backup nameserver for  MX    10  ; is the mailserver for
@             MX    20 ; equivalent to above line, "@" represents zone origin
@             MX    50 mail3              ; equivalent to above line, but using a relative host name  A             ; IPv4 address for
              AAAA  2001:db8:10::1        ; IPv6 address for
ns            A             ; IPv4 address for
              AAAA  2001:db8:10::2        ; IPv6 address for
www           CNAME          ; is an alias for
wwwtest       CNAME www                   ; is another alias for
mail          A             ; IPv4 address for,
                                          ;  any MX record host must be an address record
                                          ; as explained in RFC 2181 (section 10.3)
mail2         A             ; IPv4 address for
mail3         A             ; IPv4 address for

Now lets save this zone file on to the server using vi


Now add zone file and save – including $ORIGIN

Importing your zone file into Route 53

If you’ve not already added the zone to route 53, run this command

cli53 create

Now your can import your zone file into Route 53

cli53 import --file --replace --wait

Use this command to check your zone file has been imported into Route 53

cli53 info

Further reading


No comments yet.

Add Yours

  • Author Avatar


Comment Arrow

About Author


Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning hands down.