Skip to content
Browse files

Fixed up route53 command line script to include a delete method and

properly print out zone info on creation
  • Loading branch information...
1 parent fc797d4 commit 89a69e651f0614651e720183f0e9116d4c7165be Chris Moyer committed Feb 2, 2011
Showing with 11 additions and 2 deletions.
  1. +11 −2 bin/route53
13 bin/route53
@@ -15,8 +15,16 @@ def _print_zone_info(zoneinfo):
def create(conn, hostname, caller_reference=None, comment=''):
+ """Create a hosted zone, returning the nameservers"""
response = conn.create_hosted_zone(hostname, caller_reference, comment)
- _print_zone_info(response['CreateHostedZoneResponse'])
+ print "Pending, please add the following Name Servers:"
+ for ns in response.NameServers:
+ print "\t", ns
+def delete_zone(conn, hosted_zone_id):
+ """Delete a hosted zone by ID"""
+ response = conn.delete_hosted_zone(hosted_zone_id)
+ print response
def ls(conn):
"""List all hosted zones"""
@@ -25,14 +33,15 @@ def ls(conn):
def get(conn, hosted_zone_id, type=None, name=None, maxitems=None):
+ """Get all the records for a single zone"""
response = conn.get_all_rrsets(hosted_zone_id, type, name, maxitems=maxitems)
print '%-20s %-20s %-20s %s' % ("Name", "Type", "TTL", "Value(s)")
for record in response:
print '%-20s %-20s %-20s %s' % (, record.type, record.ttl, ",".join(record.resource_records))
def add_record(conn, hosted_zone_id, name, type, value, ttl=600, comment=""):
- """Add a new record"""
+ """Add a new record to a zone"""
from boto.route53.record import ResourceRecordSets
changes = ResourceRecordSets(conn, hosted_zone_id, comment)
change = changes.add_change("CREATE", name, type, ttl)

0 comments on commit 89a69e6

Please sign in to comment.
Something went wrong with that request. Please try again.