Github user tbouron commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/849#discussion_r142135330
--- Diff:
locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
---
@@ -2957,7 +2957,7 @@ String getHostnameAws(HostAndPort hostAndPort,
LoginCredentials userCredentials,
"get public AWS hostname",
ImmutableList.of(
BashCommands.INSTALL_CURL,
- "echo `curl --silent --retry 20
http://169.254.169.254/latest/meta-data/public-hostname`; exit"));
+ "echo `curl --silent --retry 20
http://169.254.169.254/latest/meta-data/"+(privateHost ? "local-hostname" :
"public-hostname")+"`; exit"));
--- End diff --
@andreaturli I don't think so.
`http://169.254.169.254/latest/meta-data/local-hostname`
will always return some data and a 200 as AWS assign private IP/host for
every single EC2 instance.
`http://169.254.169.254/latest/meta-data/public-hostname` could return a
404 (if the machine has been provisioned without an elastic IP, not entirely
sure though) but in this situation, but that's not what we want
---