You are viewing the documentation for an older version of boto (boto2).

Boto3, the next version of Boto, is now stable and recommended for general use. It can be used side-by-side with Boto in the same project, so it is easy to start using Boto3 in your existing projects as well as new projects. Going forward, API updates and all new feature work will be focused on Boto3.

For more information, see the documentation for boto3.

An Introduction to boto’s Route53 interface

This tutorial focuses on the boto interface to Route53 from Amazon Web Services. This tutorial assumes that you have already downloaded and installed boto.

Route53 is a Domain Name System (DNS) web service. It can be used to route requests to services running on AWS such as EC2 instances or load balancers, as well as to external services. Route53 also allows you to have automated checks to send requests where you require them.

In this tutorial, we will be setting up our services for

Creating a connection

To start using Route53 you will need to create a connection to the service as normal:

>>> import boto.route53
>>> conn = boto.route53.connect_to_region('us-west-2')

You will be using this conn object for the remainder of the tutorial to send commands to Route53.

Working with domain names

You can manipulate domains through a zone object. For example, you can create a domain name:

>>> zone = conn.create_zone("")

Note that trailing dot on that domain name is significant. This is known as a fully qualified domain name (FQDN).

>>> zone

You can also retrieve all your domain names:

>>> conn.get_zones()

Or you can retrieve a single domain:

>>> conn.get_zone("")

Finally, you can retrieve the list of nameservers that AWS has setup for this domain name as follows:

>>> zone.get_nameservers()
[u'', u'', u'', u'']

Once you have finished configuring your domain name, you will need to change your nameservers at your registrar to point to those nameservers for Route53 to work.

Setting up dumb records

You can also add, update and delete records on a zone:

>>> status = a.add_record("MX", "", "10")

When you send a change request through, the status of the update will be PENDING:

>>> status

You can call the API again and ask for the current status as follows:

>>> status.update()
>>> status

When the status has changed to INSYNC, the change has been propagated to remote servers

Updating a record

You can create, upsert or delete a single record like this

>>> zone = conn.get_zone("")
>>> change_set = ResourceRecordSets(conn,
>>> changes1 = change_set.add_change("UPSERT", "www" + "", type="CNAME", ttl=3600)
>>> changes1.add_value("")
>>> change_set.commit()

In this example we create or update, depending on the existence of the record, the CNAME to

Working with Change Sets

You can also do bulk updates using ResourceRecordSets. For example updating the TTL

>>> zone = conn.get_zone('')
>>> change_set = boto.route53.record.ResourceRecordSets(conn,
>>> for rrset in conn.get_all_rrsets(
...     u = change_set.add_change("UPSERT",, rrset.type, ttl=3600)
...     u.add_value(rrset.resource_records[0])
... results = change_set.commit()

In this example we update the TTL to 1hr (3600 seconds) for all records recursed from Note: this will also change the SOA and NS records which may not be ideal for many users.