Created
May 1, 2014 18:19
-
-
Save gansbrest/23d76d7773c38f8a3b6b to your computer and use it in GitHub Desktop.
Route 53 script to list all zones and record sets
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
require 'aws-sdk' | |
r53 = AWS::Route53.new | |
resp = r53.client.list_hosted_zones | |
# Get list of all zones | |
resp[:hosted_zones].each do |zone| | |
zone_id = zone[:id][12..-1] | |
# initialize zone objects | |
hosted_zone = r53.hosted_zones[zone_id] | |
hosted_zone.rrsets.each do |rrset| | |
# Iterating over rrset instances | |
# and applying custom searching logic | |
if rrset.alias_target | |
if (rrset.alias_target[:dns_name] =~ /string/) | |
p rrset.name + " " + rrset.alias_target[:dns_name] | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment