We use a custom Peerage.Provider implementation like
defmodule AwsServiceDiscovery do
@behaviour Peerage.Provider
@impl true
def poll do
dns_name = Application.fetch_env!(:peerage, :dns_name)
app_name = Application.fetch_env!(:peerage, :app_name)
:inet_res.lookup(String.to_charlist(dns_name), :in, :srv)
|> Enum.flat_map(fn {_priority, _weight, _port, srv_dns_name} ->
:inet_res.lookup(srv_dns_name, :in, :a)
|> Enum.map(fn ip ->
:"#{app_name}@#{:inet.ntoa(ip) |> to_string}"
end)
end)
end
end






















