class AWS::EC2::ElasticIp


The ID of the AWS account that owns the network interface (VPC only).
@attr_reader [String,nil] network_interface_owner_id
interface (VPC only).
@attr_reader [String,nil] network_interface_id The ID of the network
between this elastic ip address and an EC2 VPC instance (VPC only).
@attr_reader [String,nil] association_id The ID of the association
is for EC2 instances (‘standard’) or VPC instances (‘vpc’).
@attr_reader [String] domain Indicates whether this elastic ip address
VPC.
The ID representing the allocation of the address for use with Amazon
@attr_reader [String,nil] allocation_id
assigned to an EC2 instance, nil otherwise.
@attr_reader [String,nil] instance_id Returns the instance id if

def self.describe_call_name

def self.describe_call_name
  :describe_addresses
end

def associate options

Returns:
  • (String) - Returns the resulting association id.

Options Hash: (**options)
  • :network_interface (String, NetworkInterface) -- The id
  • :instance (String, Instance) -- The id of an instance

Parameters:
  • options (Hash) --
def associate options
  client_opts = {}
  [:instance,:network_interface,:private_ip_address].each do |opt|
    if value = options[opt]
      	key = ( opt.to_s=='instance' || opt.to_s=='network_interface' ? opt.to_s+"_id" : opt.to_s ) 
nt_opts[:"#{key}"] = value.is_a?(Resource) ? value.id : value
    end
  end
  if vpc?
    client_opts[:allocation_id] = allocation_id
  else
    client_opts[:public_ip] = public_ip
  end
  resp = client.associate_address(client_opts)
  resp.data[:association_id]
end

def associated?

Returns:
  • (Boolean) - Returns true if this IP address is associated
def associated?
  !!(instance_id || association_id)
end

def delete

Returns:
  • (nil) -
def delete
  if vpc?
    client.release_address(:allocation_id => allocation_id)
  else
    client.release_address(:public_ip => public_ip)
  end
  nil
end

def describe_call_name

def describe_call_name
  :describe_addresses
end

def disassociate

Returns:
  • (nil) -
def disassociate
  if vpc?
    client.disassociate_address(:association_id => association_id)
  else
    client.disassociate_address(:public_ip => public_ip)
  end
  nil
end

def exists?

Returns:
  • (Boolean) - Returns true the elastic ip address exists in
def exists?
  begin
    get_resource
    true
  rescue Errors::InvalidAddress::NotFound
    false
  end
end

def initialize public_ip, options = {}

def initialize public_ip, options = {}
  @public_ip = public_ip
  super
end

def instance

Returns:
  • (Instance, nil) - If associated, returns the {Instance} this
def instance
  if instance_id = self.instance_id
    Instance.new(instance_id, :config => config)
  end
end

def network_interface

Returns:
  • (NetworkInterface, nil) - Returns the network interface this
def network_interface
  if nid = network_interface_id
    NetworkInterface.new(nid, :config => config)
  end
end

def resource_id_method

def resource_id_method
  :public_ip
end

def response_id_method

def response_id_method
  :public_ip
end

def to_s

Returns:
  • (String) - Returns the public IP address
def to_s
  public_ip.to_s
end

def vpc?

Returns:
  • (Boolean) - Returns true if this is an EC2 VPC Elastic IP.
def vpc?
  domain == 'vpc'
end