Method: Fog::Compute::AWS::Real#associate_address
- Defined in:
- lib/fog/aws/requests/compute/associate_address.rb
permalink #associate_address(instance_id = nil, public_ip = nil, network_interface_id = nil, allocation_id = nil) ⇒ Object
Associate an elastic IP address with an instance
Parameters
-
instance_id<~String> - Id of instance to associate address with (conditional)
-
public_ip<~String> - Public ip to assign to instance (conditional)
-
network_interface_id<~String> - Id of a nic to associate address with (required in a vpc instance with more than one nic) (conditional)
-
allocation_id<~String> - Allocation Id to associate address with (vpc only) (conditional)
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
‘requestId’<~String> - Id of request
-
‘return’<~Boolean> - success?
-
‘associationId’<~String> - association Id for eip to node (vpc only)
-
-
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/fog/aws/requests/compute/associate_address.rb', line 24 def associate_address(instance_id=nil, public_ip=nil, network_interface_id=nil, allocation_id=nil) # Cannot specify an allocation ip and a public IP at the same time. If you have an allocation Id presumably you are in a VPC # so we will null out the public IP public_ip = allocation_id.nil? ? public_ip : nil request( 'Action' => 'AssociateAddress', 'AllocationId' => allocation_id, 'InstanceId' => instance_id, 'NetworkInterfaceId' => network_interface_id, 'PublicIp' => public_ip, :idempotent => true, :parser => Fog::Parsers::Compute::AWS::AssociateAddress.new ) end |