Method: CloudProviders::Ec2Helpers#next_unused_elastic_ip

Defined in:
lib/cloud_providers/ec2/ec2_helpers.rb

#next_unused_elastic_ipObject

Get the next usable elastic ip First, get the list of addresses from ec2 that the client has access to, then select only the ones that are not associated with an instance. If the cloud has set elastic_ips to use, then, using the intersection of the unused ips and those, find the first one available and return that.



65
66
67
68
69
70
71
72
# File 'lib/cloud_providers/ec2/ec2_helpers.rb', line 65

def next_unused_elastic_ip
  if unused_elastic_ips.empty?
    nil
  else
    vputs("Found an unused elastic ip: #{unused_elastic_ips.first}")
    unused_elastic_ips.first
  end
end