Skip to content

Instantly share code, notes, and snippets.

@gansbrest
Created May 1, 2014 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gansbrest/23d76d7773c38f8a3b6b to your computer and use it in GitHub Desktop.
Save gansbrest/23d76d7773c38f8a3b6b to your computer and use it in GitHub Desktop.
Route 53 script to list all zones and record sets
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