Ask Your Question
0

Is it possible to get an instance info by ip address?

asked 2014-04-03 05:14:31 -0500

Ekk gravatar image

We setup openstack and set it to assign floating ip when a new instance is created. I know that we can get an instance's information using its id but I wonder if it's possible to do that by an ip address?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-04-03 07:45:34 -0500

larsks gravatar image

updated 2014-04-03 07:46:10 -0500

Sure it's possible, if you're willing to write some code. For example, I have an instance with floating ip address "192.168.200.4". I can get information about floating ip from the network api:

curl -H 'x-auth-token: ...' http://localhost:9696/v2.0/floatingips

Which will get me something like:

{
  "floatingips": [
  {
    "id": "8dcbbc48-16d3-4a70-a77c-db7f5e31d604",
      "port_id": "2bc943e3-d575-4a67-ba37-19cc8516ca48",
      "floating_ip_address": "192.168.200.4",
      "fixed_ip_address": "10.0.0.2",
      "floating_network_id": "93c8ddfc-7baa-4667-a01c-dfbdf5d47f15",
      "tenant_id": "28a490a259974817b88ce490a74df8d2",
      "router_id": "acc6b46f-d040-490f-8d1f-7d6f9a0df8d9"
  },
    ],
}

This gets me a port ID, and I can find details about ports like this:

curl -H 'x-auth-token: ...' http://localhost:9696/v2.0/ports/2bc943e3-d575-4a67-ba37-19cc8516ca48

Which gives me:

{
  "port": {
    "device_id": "71d68b44-625e-4aca-81e0-fa02c80da6b3",
    "security_groups": [
      "0409e06d-f613-4732-ab66-9e2f482b369b",
      "bf0cb82a-fee9-4e6a-8a8e-4609966ed898"
    ],
.
.
.

Here the device_id is the UUID of the instance attached to this port. And if I run:

nova show 71d68b44-625e-4aca-81e0-fa02c80da6b3

I get the information about my instance.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2014-04-03 05:14:31 -0500

Seen: 94 times

Last updated: Apr 03 '14