Skip to content

Instantly share code, notes, and snippets.

@rob-b
Created September 21, 2011 15:53
Show Gist options
  • Save rob-b/1232445 to your computer and use it in GitHub Desktop.
Save rob-b/1232445 to your computer and use it in GitHub Desktop.
obtain route53 records
import boto
import sys
def dns_entries(zone_name):
access_key = u'AAAABBB'
secret_key = u'BBBBAAA'
r53 = boto.connect_route53(access_key, secret_key)
results = r53.get_all_hosted_zones()
target = None
for result in results.HostedZones:
if result['Name'] == zone_name:
target = result
break
if not target:
sys.exit(1)
zone_id = target['Id'].strip('/hostedzone/')
for record in r53.get_all_rrsets(zone_id):
yield record
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment