Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion localstack-core/localstack/aws/connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,14 @@ def resolve_dns_from_upstream(hostname: str) -> str:
if len(response.answer) == 0:
raise ValueError(f"No DNS response found for hostname '{hostname}'")

ip_addresses = list(response.answer[0].items.keys())
ip_addresses = []
for answer in response.answer:
if answer.match(dns.rdataclass.IN, dns.rdatatype.A, dns.rdatatype.NONE):
ip_addresses.extend(answer.items.keys())

if not ip_addresses:
raise ValueError(f"No DNS records of type 'A' found for hostname '{hostname}'")

return choice(ip_addresses).address


Expand Down
Loading