Fresh Produce: _instances.internal For Easy Instance Metadata Querying

Sometimes, you need to query some lower-level info about individual machines that an app is running. You can already do some pretty cool stuff, like querying our DNS server for what regions an app has instances running in:

$ dig TXT vms.real-app.internal +short
"15874f91a0e235 ord"

You can do even more interesting things like find the closest 3 instances of an app:

$ dig TXT top3.nearest.of.real-app.internal +short

This is all very exciting stuff! But what if we wanted to go even lower level? Recently, I wanted to track how much data was being sent from my app to other apps within my network, by tracking the amount of data sent to each 6PN or flycast address. I needed information on all of the instances that are running in my organization, their addresses, and what region they’re running in. I looked into it for a long time, but at the time there was simply no way to view what address corresponded to what instance, or for that matter what app or region.

Now, though, it’s an easy task. if we run a DNS TXT query on _instances.internal, we get an easy list of all instances we can process:

$ dig TXT _instances.internal +short

With an easy to read Regex, we can extract out each instance’s information, and as an example, search for which instance is assigned to an IP:
(You could probably write a good parser for this instead, but Regex solves all our problems.

We have even more .internal addresses for doing even more cool meta things, check them out!