3

This is what I THINK can happen and what I want.

I create a VPC in Amazon, put a public subnet into it, put a puppet server instance and a full stack web server instance in the VPC.

Now I set the hostname for the puppet server 'puppet' and for the web server as 'webserver'.

I then set a DHCP option set with the domain name as 'my-company-name.com.local', Use Amazon provided DNS, and associate it with the VPC. I create a Zone record using Route 53 with the same domain name.

I then force the two instances to get new DHCP leases and VOILA! they get private IP addresses and DNS gets automatically updated for forward and reverse DNS lookups.

Now 'puppet.mycompany.com.local' can find 'webserver.mycompany.com.local' and visa versa within the private side of the networking in my VPC.

The two questions are: A) Is that how DNS and DHCP work (especially the automatic cooperation between them)? I don't have to manually enter the DHCP assigned IP addresses in DNS records, do I? B) How do I set this to work, most probably, what DNS records do I need to create and any other steps?

Dennis
  • 163
  • 1
  • 6
  • 2
    Amazing, I'm still searching google for this answer, and 3 minutes later, MY QUESTION HERE shows up at the top of the list on my search. Must be a question that needs to be answered. – Dennis Mar 29 '15 at 06:45
  • 2
    Same thing happens with every single non-downvoted question on SF. :) – EEAA Mar 29 '15 at 14:18
  • 1
    Why use a .local tld? Doing so *will* make your life difficult. Just use a subdomain of your main domain. – EEAA Mar 29 '15 at 14:20
  • 1
    Actually, using .local will not work at all in your case. – EEAA Mar 29 '15 at 14:20
  • I was hoping to make it painfully obvious in any coinfig files (like for elasticsearch, couchbase, etc) that the dhcp assigned IPs for FQDNs were for PRIVATE, AKA, LOCAL addresses. So why won't '.local' work? I"m fairly new to the networking side of things. – Dennis Mar 30 '15 at 00:44
  • foo.local.example.com is nearly as "obvious" as foo.example.com.local. – EEAA Mar 30 '15 at 00:47
  • local HAS been used for this purpose in the past, but now has a murky usablity. http://en.wikipedia.org/wiki/.local I will probably have to follow your example. – Dennis Mar 30 '15 at 01:03
  • Yes, it has been used before, but it's against best practice. Aside from that, though, it won't work at all with Route53. – EEAA Mar 30 '15 at 01:12
  • EEAA, thanks for the heads up on Route53. – Dennis Apr 02 '15 at 04:27

3 Answers3

2

There are two approaches taken it seems. But backing up a second, THERE IS NO DYNAMIC DNS in Route 53, i.e. NO COOPERATION BETWEEN DHCP and DNS in VPCs on AWS.

Approach 1: http://www.ducea.com/2009/06/01/howto-update-dns-hostnames-automatically-for-your-amazon-ec2-instances/ (Requires a Bind9 dns server in the network)

Approach 2: http://cantina.co/automated-dns-for-aws-instances-using-route-53/ (requires a set of scripts and downloaded libs, plus puts an IAM Role credential allowing DNS updates ON EVERY SERVER IN YOUR SYSTEM. One hacked box and your network is toast.)

What am I going to do? I need to run puppet anyway, and TheForeman comes with Bind9 and a dhcp server included. So I will just dedicate an instance to that.

slm
  • 7,615
  • 16
  • 56
  • 76
Dennis
  • 163
  • 1
  • 6
1

I used the details of the above question; here's some additional things:

In your internal hosted zone (eg here in), create CNAMEs not A records for your hosts eg

test.in. CNAME ip-10-0-9.56.us-west-2.compute.internal

For the DHCP option set, make sure you have the following set

domain-name = in
domain-name-servers = AmazonProvidedDNS 
Sonia Hamilton
  • 341
  • 1
  • 4
  • 11
0

If your are using scripting to deploy the ec2 instance: You can set the DNS record at same time you create it, i.e (terraform)

resource "aws_route53_record" "ec2_alias_record" {
   zone_id = "${var.domain_id}"
   name = "MyComputer"
   type = "CNAME"
   ttl = "300"
   records = ["${aws_instance.ec2_instance.public_ip}"]
}

Every you are creating (re-creating) the instance the record is updated. And you can parametrise in order to create N instances and N records with some count.index +1 variable over a loop. Hope this helps.

womble
  • 96,255
  • 29
  • 175
  • 230
aureli
  • 1