13

We have a part of our Java application that needs to determine what the local hostname is.

But whenever we try to get them via

InetAddress.getLocalhost().getHostName()

we get:

org.quartz.JobExecutionException: java.net.UnknownHostException: 22e51fd8a6fb: 22e51fd8a6fb [See nested exception: java.net.UnknownHostException: 22e51fd8a6fb: 22e51fd8a6fb]

When we do this via ec2 instances, it seems to work fine. Is there some kind of limitation on fargate, or potentially some configuration that could be tweaked?

froi
  • 7,268
  • 5
  • 40
  • 78

2 Answers2

1

Verify "DNS hostnames" is set as "Enabled" in you VPC settings. This should fix the problem.

0

This was a known issue in the ECS agent. The Fargate platform was recently patched and attempting to resolve localhost should no longer result in an exception. You may need to restart your service or task for the new runtime to kick in.

Roy Kachouh
  • 1,855
  • 16
  • 24
  • 2
    This does not seem to be correct. I have the same issue still today, with Fargate platform 1.3.0. I deleted and recreated the service to be sure but no change. – LCC Sep 11 '19 at 13:53