2

I have an Amazon EC2 instance running and I am installing a program on it that needs to know what the machine's IP address is. Can I set the Elastic IP address to the IP address within the EC2 instance?

Its okay if it reroutes data packets somewhere 'outside' and then back to itself, but the software NEEDs me to specify an IP address of the machine its on.


I proceeded with the software installation using the "local IP" (10.xx.xx.xx) within the software installation. I don't know if this is the reason why the application is not visible publicly (as I'm trying to determine in the question Allowing web access to an Amazon EC2 Windows Server 2008 instance running Tomcat+application?)

2 Answers 2

1

You should always have the instance applications bind to the local address (10.x.x.x) since this is what the machines see as their ethernet connection. The external IP address is an address you can reach externally, then Amazon takes care of routing that to the actual machine.

You other question answers this question more explicitly for your case though.

2
  • are you sure about that? i remember that it was once necessary for me to add the external (elastic) address as listening address to proftpd so one could connect from external. internal from another amazon instance worked. Jan 5, 2011 at 18:56
  • Flashman is right, you need not specify external IP address, ec2 takes care of the routing. As your app is not publicly visible, have you looked at the ec2 security group and allowed appropriate ports on it?
    – Tutul
    Apr 23, 2012 at 21:07
0

Can I set the Elastic IP address to the IP address within the EC2 instance?

To my knowledge with EC2: no

Your instance can retrieve its assigned ip address by calling a site like http://www.ip-adress.com/IP_adresse/ from within. A simple python or perl script can be used for that. But I am not sure if that helps.

On the other hand, I have no problems with email servers setups etc.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .