The issue was that I had "DNS hostname" setting for the VPC as disabled. Both "DNS resolution" and "DNS hostname" needs to be enabled as mentioned here: https://docs.aws.amazon.com/vpc/latest/userguide/AmazonDNS-concepts.html#vpc-dns-support
If you use custom DNS domain names defined in a private hosted zone in Amazon RouteĀ 53, or use private DNS with interface VPC endpoints (AWS PrivateLink), you must set both the
enableDnsHostnames
andenableDnsSupport
attributes totrue
.