Permalink
Browse files

Fix "Dynamic private DNS example"

  • Loading branch information...
bells17 committed Dec 18, 2017
1 parent c353384 commit 198f5401b7bec4761b3ae2ae44f1db3f9df8a398
Showing with 4 additions and 4 deletions.
  1. +4 −4 README.md
@@ -191,13 +191,13 @@ hosted_zone "us-east-1.my.local." do
resp = Aws::EC2::Client.new(region: "us-east-1").describe_instances(filters:[{ name: 'vpc-id', values: ["vpc-xxxxxxxx"] }])
instances = resp.reservations.each_with_object({}) do |reservation, reservations|
reservations.merge!(reservation.instances.each_with_object({}) do |instance, instances|
instances[instance.private_ip_address] = instance.tags.find {|tag| tag['key'] == 'Name' }['value']
tag_name = instance.tags.find {|tag| tag['key'] == 'Name' }
instances[instance.private_ip_address] = tag_name['value'] if tag_name and tag_name['value'] != ''
end)
end
instances.each {|private_ip_address, tagName|
tagName = instance.tags.find {|tag| tag['key'] == 'Name' }['value']
rrset "#{tagName}.us-east-1.my.local.", "A" do
instances.each {|private_ip_address, tag_name|
rrset "#{tag_name}.us-east-1.my.local.", "A" do
ttl 300
resource_records private_ip_address
end

0 comments on commit 198f540

Please sign in to comment.