I did something similar here[0] when I wanted all the internal hostnames I had to resolve locally via dnsmasq:
https://github.com/winks/dotfiles/blob/master/bin/ec2-dns.py