0

I have a amazon instance, that has several elastic ips assigned to it.

Looking at this answer, I have found a way to get one of the elastic ips of the instance, the one I use to ssh into it.

However, I would like to know if there is a way to get all the elastic ips assigned to the machine.

How do I get a list of all elastic ips assigned to my amazon instance?

Thanks!

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
RandomGuyqwert
  • 425
  • 6
  • 18

1 Answers1

2

See http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-instance-metadata.html

Following should list elastic IPs:

curl http://169.254.169.254/latest/meta-data/network/interfaces/macs/<list-actual-mac-here>/public-ipv4s/
Ashish-G
  • 417
  • 3
  • 7
  • Thank you for your answer! This indeed worked. However, I had to first add my private ip to which the elastic ip was bound to a virtual eth interface. I would like to automate the process of creating virtual eth interfaces and binding private ips to them, however, I am not yet sure how to find my private ips. Is there any chance you know how to find that out as well? – RandomGuyqwert May 20 '16 at 12:44
  • aws cli will give similar results. @RandomGuyqwert : study the AWS SDK API, you can write the automation. – mootmoot May 20 '16 at 13:12
  • I considered the aws cli. The problem is, in my situation, it's not really an option. In order to use the cli and get info on the machine, I need to use auth. I want to do the setup directly on the instance, and deploy new instances at will. Using anything that requires auth is not an option for me at them moment. – RandomGuyqwert May 20 '16 at 13:59
  • @RandomGuyqwert you can check `curl http://169.254.169.254/latest/meta-data/local-ipv4` for local/private IP; and similarly `curl http://169.254.169.254/latest/meta-data/public-ipv4` for public IP. Feel free to explore `curl http://169.254.169.254/latest/meta-data/` - likely all the other data that you might need is here! – Ashish-G May 20 '16 at 16:15