There is a problem handling the life cycle actions of an auto-scaling group inside a VPC if the VPC has DNS resolution turned off.
In such a case, the VPC does not actually set a "public dns name" (or a private one either) to the instance - even though all AWS IPs have DNS names that can be found by reverse lookup. When the lambda tries to set up SRV records using a hostname, it fails to generate a correct format and errors out. If the same lambda is also responsible for setting up DNSRR, that also fails.
The lambda should detect this and fallback to something reasonable - either perform the reverse lookup to find a useful hostname or just use the IP address in the SRV record - there's no real reason to prefer a hostname there.
There is a problem handling the life cycle actions of an auto-scaling group inside a VPC if the VPC has DNS resolution turned off.
In such a case, the VPC does not actually set a "public dns name" (or a private one either) to the instance - even though all AWS IPs have DNS names that can be found by reverse lookup. When the lambda tries to set up SRV records using a hostname, it fails to generate a correct format and errors out. If the same lambda is also responsible for setting up DNSRR, that also fails.
The lambda should detect this and fallback to something reasonable - either perform the reverse lookup to find a useful hostname or just use the IP address in the SRV record - there's no real reason to prefer a hostname there.