I've used the AWS metadata trick as well. I kind of liked the solution; better use something that the machine is already relying on than adding something extra.
DNS is also usually a much better option than the framework-specific service discovery mechanism that every framework seems to be destined to reinvent. I think the problem is that most computer scientists aren't very well-versed in networking, and DNS doesn't look like the best match at first glance.