Floating IPs (elastic IPs in Amazon EC2 terminology) allow instances to talk to an external host or access to the instances from an external network. A floating IP can be allocated to a project before or after launching an instance, we’ll do it before.
We need to know available floating IP pools:
1
2
|
>>> nova.floating_ip_pools.
list
()
[<FloatingIPPool: name
=
ext_net>]
|
A list containing only one pool is shown (‘ext_net’). So let’s request a floating IP to ext_net and store the result (a FloatingIP object) in the variable “floating_ip”:
1
|
>>> floating_ip = nova.floating_ips.create(nova.floating_ip_pools.list()[0].name)
|
We can see IP allocated to project:
1
2
|
>>> floating_ip.ip
u
'172.22.196.59'
|