Created
September 21, 2011 15:53
-
-
Save rob-b/1232445 to your computer and use it in GitHub Desktop.
obtain route53 records
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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