Get the public / local IP of your EC2 instance via command line

While you can get the public and private IP address of your Amazon EC2 instance via the AWS Console, it may be extremely useful to query it from anywhere you can make an HTTP request, such a shell script. The operation is really simple, just make a GET request to the following URL from within your EC2 instance:

Local IP:


Public IP:


I often use this feature to pre-configure services and update configuration files, as in EC2 you get a new IP Address each time you reboot.