Reputation: 5247
I want to know the elastic ip associatied with my ec2-instance. When i remote via putty and type ifconfig it's doesn't display elastic ip and providing the internal ip. Is there a unix command to get the elastic ip?
Upvotes: 0
Views: 79
Reputation: 6824
If you prefer http requests then regardless of OS:
http://169.254.169.254/latest/meta-data/public-ipv4
Feel free to explore http://169.254.169.254/
tree. Please note slash is required after some nodes in the tree despite it isn't visible in the answer from the upper level.
For example:
root@aw [~]# curl -w "\n" http://169.254.169.254/latest/
dynamic
meta-data
user-data
Row dynamic
does not have slash at the end, but if you try as is you'll see nothing:
root@aw [~]# curl -w "\n" http://169.254.169.254/latest/dynamic
(empty line)
Then try with slash:
root@aw [~]# curl -w "\n" http://169.254.169.254/latest/dynamic/
instance-identity/
Of course this 'website' works inside AWS only.
Upvotes: 1
Reputation: 2389
At the command line, type ec2metadata
for ubuntu-based images. On the amazon-based images, I use ec2-metadata
Your public ip will be among the other data displayed.
Upvotes: 2