vendredi 29 mai 2015

Using the public IP on AWS from java getCanonicalHostName method

I'm trying to use AWS as a scalable analytics tool. I'm using apache zeppelin as an interactive shell to a Spark cluster and trying to plot using wisp. This is causing a problem as the plotting approach in wisp is to start a web app based on what I think is a jetty server. This works well on my local machine but on AWS it does not work as it picks up the private IP address rather than the public one.

Within wisp, it uses java.net.InetAddress.getLocalHost.getCanonicalHostName to retrieve the IP address of the machine. This always returns the private FQDN address. How can I make the java function return the public IP address or FQDN AWS provides without hardcoding something in wisp every time I spin up a cluster and rebuilding?

I have tried changing /etc/hosts and /etc/hostname but both have no effect. I don't really know where java.net.InetAddress.getLocalHost.getCanonicalHostName is getting it's address from.

Any help or advice greatly appreciated.

Dean




Aucun commentaire:

Enregistrer un commentaire