If you run "ifconfig –a" on an amazon ec2 instance (linux), it will give you the internal IP address, which is not accessible from outside world. Here is a way to get the public and private IP address for an amazon EC2 instance.

To obtain the IP addresses, issue the following HTTP queries from within the instance:

To obtain the internal IP address:


To obtain the public IP address:

Alternatively, you can obtain the public and private DNS name/IP of an EC2 instance from AWS console (or from any service provider like RightScale.)

Subscribe - To get an automatic feed of all future posts subscribe here, or to receive them via email go here and enter your email address in the box. You can also like us on facebook and follow me on Twitter @akashag1001.